From f8979d60c3479cd617fa048b83cd3c9c96e3f32e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 14 Oct 2014 01:59:53 +0300 Subject: MADS: Initial implementation of sound driver handling for V2 games --- engines/mads/nebular/menu_nebular.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 3919e70a09..881481b613 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -902,7 +902,11 @@ void AnimationView::loadNextResource() { const char *chP = strchr(_currentAnimation->_header._soundName.c_str(), '.'); assert(chP); - int driverNum = atoi(chP + 1); + // Handle both Rex naming (xxx.009) and naming in later games (e.g. xxx.ph9) + int driverNum = atoi(chP + 3); + // HACK for Dragon + if (_currentAnimation->_header._soundName == "#SOUND.DRG") + driverNum = 9; _vm->_sound->init(driverNum); } -- cgit v1.2.3 From b212e2c6ed5060dba5d5d58c8391c32dfb9f354e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 13 Oct 2014 20:28:34 -0400 Subject: MADS: New conversation message logic for cutscene animations --- engines/mads/nebular/menu_nebular.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 881481b613..5cb175eb80 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -890,9 +890,9 @@ void AnimationView::loadNextResource() { // Load the new animation delete _currentAnimation; _currentAnimation = Animation::init(_vm, &scene); + int flags = ANIMFLAG_ANIMVIEW | (resEntry._bgFlag ? ANIMFLAG_LOAD_BACKGROUND : 0); _currentAnimation->load(scene._backgroundSurface, scene._depthSurface, - resEntry._resourceName, resEntry._bgFlag ? ANIMFLAG_LOAD_BACKGROUND : 0, - &paletteCycles, _sceneInfo); + resEntry._resourceName, flags, &paletteCycles, _sceneInfo); // Signal for a screen refresh scene._spriteSlots.fullRefresh(); -- cgit v1.2.3 From d8b1612f1a995120444c8100088682b870c43f28 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Oct 2014 21:37:00 -0400 Subject: MADS: Implement subtitles for animation cutscenes --- engines/mads/nebular/menu_nebular.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 5cb175eb80..64f1b82bf1 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -55,6 +55,8 @@ void MenuView::show() { while (!_breakFlag && !_vm->shouldQuit()) { if (_redrawFlag) { + scene._kernelMessages.update(); + _vm->_game->_scene.drawElements(_vm->_game->_fx, _vm->_game->_fx); _redrawFlag = false; } -- cgit v1.2.3 From b25b3981527ff343c4959984ab3d630c6b8b4528 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Oct 2014 21:49:14 -0400 Subject: MADS: Fix clearing on-screen messages when the cutscene animation changes --- engines/mads/nebular/menu_nebular.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 64f1b82bf1..591d745f7a 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -889,6 +889,9 @@ void AnimationView::loadNextResource() { if (resEntry._bgFlag) palette.resetGamePalette(1, 8); + // Free any previous messages + scene._kernelMessages.reset(); + // Load the new animation delete _currentAnimation; _currentAnimation = Animation::init(_vm, &scene); -- cgit v1.2.3 From eb84b1370087dc06f55e5afed18736c71c4a1ece Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 14 Oct 2014 22:29:29 -0400 Subject: MADS: Correct the color for the top/bottom line bounding the cutscene --- engines/mads/nebular/menu_nebular.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 591d745f7a..6a13cea195 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -889,9 +889,24 @@ void AnimationView::loadNextResource() { if (resEntry._bgFlag) palette.resetGamePalette(1, 8); + palette._mainPalette[253 * 3] = palette._mainPalette[253 * 3 + 1] + = palette._mainPalette[253 * 3 + 2] = 0xb4; + palette.setPalette(&palette._mainPalette[253 * 3], 253, 1); + // Free any previous messages scene._kernelMessages.reset(); + // Handle the bars at the top/bottom + if (resEntry._showWhiteBars) { + // For animations the screen has been clipped to the middle 156 rows. + // So although it's slightly messy, bypass our screen class entirely, + // and draw the horizontal lines directly on the physiacl screen surface + Graphics::Surface *s = g_system->lockScreen(); + s->hLine(0, 20, MADS_SCREEN_WIDTH, 253); + s->hLine(0, 179, MADS_SCREEN_WIDTH, 253); + g_system->unlockScreen(); + } + // Load the new animation delete _currentAnimation; _currentAnimation = Animation::init(_vm, &scene); -- cgit v1.2.3 From 673537bad93f0b440172a0cc263ebf19cc95ffc0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 15 Oct 2014 11:33:14 +0300 Subject: MADS: Move all the anim and text view code into a common class The animation and text players are more or less common among all MADS games --- engines/mads/nebular/dialogs_nebular.cpp | 61 --- engines/mads/nebular/dialogs_nebular.h | 32 -- engines/mads/nebular/menu_nebular.cpp | 753 +------------------------------ engines/mads/nebular/menu_nebular.h | 190 +------- 4 files changed, 2 insertions(+), 1034 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 35a7d3bdc6..86244bd3bb 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -553,67 +553,6 @@ void PictureDialog::restore() { /*------------------------------------------------------------------------*/ -FullScreenDialog::FullScreenDialog(MADSEngine *vm) : _vm(vm) { - _screenId = 990; - _palFlag = true; -} - -FullScreenDialog::~FullScreenDialog() { - _vm->_screen.resetClipBounds(); - _vm->_game->_scene.restrictScene(); -} - -void FullScreenDialog::display() { - Game &game = *_vm->_game; - Scene &scene = game._scene; - - int nextSceneId = scene._nextSceneId; - int currentSceneId = scene._currentSceneId; - int priorSceneId = scene._priorSceneId; - - if (_screenId > 0) { - SceneInfo *sceneInfo = SceneInfo::init(_vm); - sceneInfo->load(_screenId, 0, "", 0, scene._depthSurface, scene._backgroundSurface); - } - - scene._priorSceneId = priorSceneId; - scene._currentSceneId = currentSceneId; - scene._nextSceneId = nextSceneId; - - _vm->_events->initVars(); - game._kernelMode = KERNEL_ROOM_INIT; - - byte pal[768]; - if (_vm->_screenFade) { - Common::fill(&pal[0], &pal[PALETTE_SIZE], 0); - _vm->_palette->setFullPalette(pal); - } else { - _vm->_palette->getFullPalette(pal); - _vm->_palette->fadeOut(pal, nullptr, 0, PALETTE_COUNT, 0, 1, 1, 16); - } - - // Set Fx state and palette entries - game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? kTransitionFadeIn : kCenterVertTransition; - game._trigger = 0; - - // Clear the screen and draw the upper and lower horizontal lines - _vm->_screen.empty(); - _vm->_palette->setLowRange(); - _vm->_screen.hLine(0, 20, MADS_SCREEN_WIDTH, 2); - _vm->_screen.hLine(0, 179, MADS_SCREEN_WIDTH, 2); - _vm->_screen.copyRectToScreen(Common::Rect(0, 0, MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT)); - - // Restrict the screen to the area between the two lines - _vm->_screen.setClipBounds(Common::Rect(0, DIALOG_TOP, MADS_SCREEN_WIDTH, - DIALOG_TOP + MADS_SCENE_HEIGHT)); - _vm->_game->_scene.restrictScene(); - - if (_screenId > 0) - scene._spriteSlots.fullRefresh(); -} - -/*------------------------------------------------------------------------*/ - GameDialog::DialogLine::DialogLine() { _active = true; _state = DLGSTATE_UNSELECTED; diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index f64f992611..d00cd87ead 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -31,8 +31,6 @@ namespace MADS { namespace Nebular { -#define DIALOG_TOP 22 - enum CapitalizationMode { kUppercase = 0, kLowercase = 1, kUpperAndLower = 2 }; class DialogsNebular : public Dialogs { @@ -109,36 +107,6 @@ enum DialogTextAlign { ALIGN_NONE = 0, ALIGN_CENTER = -1, ALIGN_AT_CENTER = -2, enum DialogState { DLGSTATE_UNSELECTED = 0, DLGSTATE_SELECTED = 1, DLGSTATE_FOCUSED = 2 }; -class FullScreenDialog: public EventTarget { -protected: - /** - * Engine reference - */ - MADSEngine *_vm; - - /** - * Screen/scene to show background from - */ - int _screenId; - - /** - * Flag for palette initialization - */ - bool _palFlag; - - /** - * Handles displaying the screen background and dialog - */ - virtual void display(); -public: - /** - * Constructor - */ - FullScreenDialog(MADSEngine *vm); - - virtual ~FullScreenDialog(); -}; - class GameDialog: public FullScreenDialog { struct DialogLine { bool _active; diff --git a/engines/mads/nebular/menu_nebular.cpp b/engines/mads/nebular/menu_nebular.cpp index 6a13cea195..717e3f6cf9 100644 --- a/engines/mads/nebular/menu_nebular.cpp +++ b/engines/mads/nebular/menu_nebular.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "mads/game.h" #include "mads/mads.h" +#include "mads/menu_views.h" #include "mads/resources.h" #include "mads/scene.h" #include "mads/screen.h" @@ -36,58 +37,6 @@ namespace Nebular { #define MADS_MENU_Y ((MADS_SCREEN_HEIGHT - MADS_SCENE_HEIGHT) / 2) #define MADS_MENU_ANIM_DELAY 70 -MenuView::MenuView(MADSEngine *vm) : FullScreenDialog(vm) { - _breakFlag = false; - _redrawFlag = true; - _palFlag = false; -} - -void MenuView::show() { - Scene &scene = _vm->_game->_scene; - EventsManager &events = *_vm->_events; - _vm->_screenFade = SCREEN_FADE_FAST; - - scene._spriteSlots.reset(true); - display(); - - events.setEventTarget(this); - events.hideCursor(); - - while (!_breakFlag && !_vm->shouldQuit()) { - if (_redrawFlag) { - scene._kernelMessages.update(); - - _vm->_game->_scene.drawElements(_vm->_game->_fx, _vm->_game->_fx); - _redrawFlag = false; - } - - _vm->_events->waitForNextFrame(); - _vm->_game->_fx = kTransitionNone; - doFrame(); - } - - events.setEventTarget(nullptr); - _vm->_sound->stop(); -} - -void MenuView::display() { - _vm->_palette->resetGamePalette(4, 8); - - FullScreenDialog::display(); -} - -bool MenuView::onEvent(Common::Event &event) { - if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_LBUTTONDOWN) { - _breakFlag = true; - _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU; - return true; - } - - return false; -} - -/*------------------------------------------------------------------------*/ - MainMenu::MainMenu(MADSEngine *vm): MenuView(vm) { Common::fill(&_menuItems[0], &_menuItems[7], (SpriteAsset *)nullptr); Common::fill(&_menuItemIndexes[0], &_menuItemIndexes[7], -1); @@ -426,706 +375,6 @@ bool AdvertView::onEvent(Common::Event &event) { return false; } -/*------------------------------------------------------------------------*/ - -char TextView::_resourceName[100]; -#define TEXTVIEW_LINE_SPACING 2 -#define TEXT_ANIMATION_DELAY 100 -#define TV_NUM_FADE_STEPS 40 -#define TV_FADE_DELAY_MILLI 50 - -void TextView::execute(MADSEngine *vm, const Common::String &resName) { - assert(resName.size() < 100); - Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName)); - vm->_dialogs->_pendingDialog = DIALOG_TEXTVIEW; -} - -TextView::TextView(MADSEngine *vm) : MenuView(vm) { - _animating = false; - _panSpeed = 0; - _spareScreen = nullptr; - _scrollCount = 0; - _lineY = -1; - _scrollTimeout = 0; - _panCountdown = 0; - _translationX = 0; - _screenId = -1; - - _font = _vm->_font->getFont(FONT_CONVERSATION); - _vm->_palette->resetGamePalette(4, 0); - - load(); -} - -TextView::~TextView() { -} - -void TextView::load() { - Common::String scriptName(_resourceName); - scriptName += ".txr"; - - if (!_script.open(scriptName)) - error("Could not open resource %s", _resourceName); - - processLines(); -} - -void TextView::processLines() { - if (_script.eos()) - error("Attempted to read past end of response file"); - - while (!_script.eos()) { - // Read in the next line - _script.readLine(_currentLine, 79); - char *p = _currentLine + strlen(_currentLine) - 1; - if (*p == '\n') - *p = '\0'; - - // Commented out line, so go loop for another - if (_currentLine[0] == '#') - continue; - - // Process the line - char *cStart = strchr(_currentLine, '['); - if (cStart) { - while (cStart) { - // Loop for possible multiple commands on one line - char *cEnd = strchr(_currentLine, ']'); - if (!cEnd) - error("Unterminated command '%s' in response file", _currentLine); - - *cEnd = '\0'; - processCommand(); - - // Copy rest of line (if any) to start of buffer - Common::strlcpy(_currentLine, cEnd + 1, sizeof(_currentLine)); - - cStart = strchr(_currentLine, '['); - } - - if (_currentLine[0]) { - processText(); - break; - } - - } else { - processText(); - break; - } - } -} - -void TextView::processCommand() { - Scene &scene = _vm->_game->_scene; - Common::String scriptLine(_currentLine + 1); - scriptLine.toUppercase(); - const char *paramP; - const char *commandStr = scriptLine.c_str(); - - if (!strncmp(commandStr, "BACKGROUND", 10)) { - // Set the background - paramP = commandStr + 10; - resetPalette(); - int screenId = getParameter(¶mP); - - SceneInfo *sceneInfo = SceneInfo::init(_vm); - sceneInfo->load(screenId, 0, "", 0, scene._depthSurface, scene._backgroundSurface); - scene._spriteSlots.fullRefresh(); - _redrawFlag = true; - - } else if (!strncmp(commandStr, "GO", 2)) { - _animating = true; - - } else if (!strncmp(commandStr, "PAN", 3)) { - // Set panning values - paramP = commandStr + 3; - int panX = getParameter(¶mP); - int panY = getParameter(¶mP); - int panSpeed = getParameter(¶mP); - - if ((panX != 0) || (panY != 0)) { - _pan = Common::Point(panX, panY); - _panSpeed = panSpeed; - } - - } else if (!strncmp(commandStr, "DRIVER", 6)) { - // Set the driver to use - paramP = commandStr + 7; - - if (!strncmp(paramP, "#SOUND.00", 9)) { - int driverNum = paramP[9] - '0'; - _vm->_sound->init(driverNum); - } - } else if (!strncmp(commandStr, "SOUND", 5)) { - // Set sound number - paramP = commandStr + 5; - int soundId = getParameter(¶mP); - _vm->_sound->command(soundId); - - } else if (!strncmp(commandStr, "COLOR", 5) && ((commandStr[5] == '0') || - (commandStr[5] == '1'))) { - // Set the text colors - int index = commandStr[5] - '0'; - paramP = commandStr + 6; - - byte r = getParameter(¶mP); - byte g = getParameter(¶mP); - byte b = getParameter(¶mP); - - _vm->_palette->setEntry(5 + index, r, g, b); - - } else if (!strncmp(commandStr, "SPARE", 5)) { - // Sets a secondary background number that can be later switched in with a PAGE command - paramP = commandStr + 6; - int spareIndex = commandStr[5] - '0'; - assert(spareIndex < 4); - int screenId = getParameter(¶mP); - - // Load the spare background - SceneInfo *sceneInfo = SceneInfo::init(_vm); - sceneInfo->_width = MADS_SCREEN_WIDTH; - sceneInfo->_height = MADS_SCENE_HEIGHT; - _spareScreens[spareIndex].setSize(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); - sceneInfo->loadMadsV1Background(screenId, "", SCENEFLAG_TRANSLATE, - _spareScreens[spareIndex]); - delete sceneInfo; - - } else if (!strncmp(commandStr, "PAGE", 4)) { - // Signals to change to a previous specified secondary background - paramP = commandStr + 4; - int spareIndex = getParameter(¶mP); - - // Only allow background switches if one isn't currently in progress - if (!_spareScreen && _spareScreens[spareIndex].getPixels() != nullptr) { - _spareScreen = &_spareScreens[spareIndex]; - _translationX = 0; - } - - } else { - error("Unknown response command: '%s'", commandStr); - } -} - -int TextView::getParameter(const char **paramP) { - if ((**paramP != '=') && (**paramP != ',')) - return 0; - - int result = 0; - ++*paramP; - while ((**paramP >= '0') && (**paramP <= '9')) { - result = result * 10 + (**paramP - '0'); - ++*paramP; - } - - return result; -} - -void TextView::processText() { - int xStart; - - if (!strcmp(_currentLine, "***")) { - // Special signifier for end of script - _scrollCount = _font->getHeight() * 13; - _lineY = -1; - return; - } - - _lineY = 0; - - // Lines are always centered, except if line contains a '@', in which case the - // '@' marks the position that must be horizontally centered - char *centerP = strchr(_currentLine, '@'); - if (centerP) { - *centerP = '\0'; - xStart = (MADS_SCREEN_WIDTH / 2) - _font->getWidth(_currentLine); - - // Delete the @ character and shift back the remainder of the string - char *p = centerP + 1; - if (*p == ' ') ++p; - strcpy(centerP, p); - - } else { - int lineWidth = _font->getWidth(_currentLine); - xStart = (MADS_SCREEN_WIDTH - lineWidth) / 2; - } - - // Add the new line to the list of pending lines - TextLine tl; - tl._pos = Common::Point(xStart, MADS_SCENE_HEIGHT); - tl._line = _currentLine; - tl._textDisplayIndex = -1; - _textLines.push_back(tl); -} - -void TextView::display() { - FullScreenDialog::display(); -} - -void TextView::resetPalette() { - _vm->_palette->resetGamePalette(8, 8); - _vm->_palette->setEntry(5, 0, 63, 63); - _vm->_palette->setEntry(6, 0, 45, 45); -} - -void TextView::doFrame() { - Scene &scene = _vm->_game->_scene; - if (!_animating) - return; - - // Only update state if wait period has expired - uint32 currTime = g_system->getMillis(); - - // If a screen transition is in progress and it's time for another column, handle it - if (_spareScreen) { - byte *srcP = _spareScreen->getBasePtr(_translationX, 0); - byte *bgP = scene._backgroundSurface.getBasePtr(_translationX, 0); - byte *screenP = (byte *)_vm->_screen.getBasePtr(_translationX, 0); - - for (int y = 0; y < MADS_SCENE_HEIGHT; ++y, srcP += MADS_SCREEN_WIDTH, - bgP += MADS_SCREEN_WIDTH, screenP += MADS_SCREEN_WIDTH) { - *bgP = *srcP; - *screenP = *srcP; - } - - // Flag the column of the screen is modified - _vm->_screen.copyRectToScreen(Common::Rect(_translationX, 0, - _translationX + 1, MADS_SCENE_HEIGHT)); - - // Keep moving the column to copy to the right - if (++_translationX == MADS_SCREEN_WIDTH) { - // Surface transition is complete - _spareScreen = nullptr; - } - } - - // Make sure it's time for an update - if (currTime < _scrollTimeout) - return; - _scrollTimeout = g_system->getMillis() + TEXT_ANIMATION_DELAY; - _redrawFlag = true; - - // If any panning values are set, pan the background surface - if ((_pan.x != 0) || (_pan.y != 0)) { - if (_panCountdown > 0) { - --_panCountdown; - return; - } - - // Handle horizontal panning - if (_pan.x != 0) { - byte *lineTemp = new byte[_pan.x]; - for (int y = 0; y < MADS_SCENE_HEIGHT; ++y) { - byte *pixelsP = (byte *)scene._backgroundSurface.getBasePtr(0, y); - - // Copy the first X pixels into temp buffer, move the rest of the line - // to the start of the line, and then move temp buffer pixels to end of line - Common::copy(pixelsP, pixelsP + _pan.x, lineTemp); - Common::copy(pixelsP + _pan.x, pixelsP + MADS_SCREEN_WIDTH, pixelsP); - Common::copy(lineTemp, lineTemp + _pan.x, pixelsP + MADS_SCREEN_WIDTH - _pan.x); - } - - delete[] lineTemp; - } - - // Handle vertical panning - if (_pan.y != 0) { - // Store the bottom Y lines into a temp buffer, move the rest of the lines down, - // and then copy the stored lines back to the top of the screen - byte *linesTemp = new byte[_pan.y * MADS_SCREEN_WIDTH]; - byte *pixelsP = (byte *)scene._backgroundSurface.getBasePtr(0, MADS_SCENE_HEIGHT - _pan.y); - Common::copy(pixelsP, pixelsP + MADS_SCREEN_WIDTH * _pan.y, linesTemp); - - for (int y = MADS_SCENE_HEIGHT - 1; y >= _pan.y; --y) { - byte *destP = (byte *)scene._backgroundSurface.getBasePtr(0, y); - byte *srcP = (byte *)scene._backgroundSurface.getBasePtr(0, y - _pan.y); - Common::copy(srcP, srcP + MADS_SCREEN_WIDTH, destP); - } - - Common::copy(linesTemp, linesTemp + _pan.y * MADS_SCREEN_WIDTH, - (byte *)scene._backgroundSurface.getPixels()); - delete[] linesTemp; - } - - // Flag for a full screen refresh - scene._spriteSlots.fullRefresh(); - } - - // Scroll all active text lines up - for (int i = _textLines.size() - 1; i >= 0; --i) { - TextLine &tl = _textLines[i]; - if (tl._textDisplayIndex != -1) - // Expire the text line that's already on-screen - scene._textDisplay.expire(tl._textDisplayIndex); - - tl._pos.y--; - if (tl._pos.y < 0) { - _textLines.remove_at(i); - } else { - tl._textDisplayIndex = scene._textDisplay.add(tl._pos.x, tl._pos.y, - 0x605, -1, tl._line, _font); - } - } - - if (_scrollCount > 0) { - // Handling final scrolling of text off of screen - if (--_scrollCount == 0) { - scriptDone(); - return; - } - } else { - // Handling a text row - if (++_lineY == (_font->getHeight() + TEXTVIEW_LINE_SPACING)) - processLines(); - } -} - -void TextView::scriptDone() { - _breakFlag = true; - _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU; -} - -/*------------------------------------------------------------------------*/ - -char AnimationView::_resourceName[100]; - -void AnimationView::execute(MADSEngine *vm, const Common::String &resName) { - assert(resName.size() < 100); - Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName)); - vm->_dialogs->_pendingDialog = DIALOG_ANIMVIEW; -} - -AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) { - _redrawFlag = false; - - _soundDriverLoaded = false; - _previousUpdate = 0; - _screenId = -1; - _resetPalette = false; - _resyncMode = NEVER; - _v1 = 0; - _v2 = -1; - _resourceIndex = -1; - _currentAnimation = nullptr; - _sfx = 0; - _soundFlag = _bgLoadFlag = true; - _showWhiteBars = true; - _manualFrameNumber = 0; - _manualSpriteSet = nullptr; - _manualStartFrame = _manualEndFrame = 0; - _manualFrame2 = 0; - _animFrameNumber = 0; - _nextCyclingActive = false; - _sceneInfo = SceneInfo::init(_vm); - - load(); -} - -AnimationView::~AnimationView() { - delete _currentAnimation; - delete _sceneInfo; -} - -void AnimationView::load() { - Common::String resName(_resourceName); - if (!resName.hasSuffix(".")) - resName += ".res"; - - if (!_script.open(resName)) - error("Could not open resource %s", resName.c_str()); - - processLines(); -} - -void AnimationView::display() { - Scene &scene = _vm->_game->_scene; - _vm->_palette->initPalette(); - Common::fill(&_vm->_palette->_cyclingPalette[0], &_vm->_palette->_cyclingPalette[PALETTE_SIZE], 0); - - _vm->_palette->resetGamePalette(1, 8); - scene._spriteSlots.reset(); - scene._paletteCycles.clear(); - - MenuView::display(); -} - -bool AnimationView::onEvent(Common::Event &event) { - // Wait for the Escape key or a mouse press - if (((event.type == Common::EVENT_KEYDOWN) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) || - (event.type == Common::EVENT_RBUTTONUP)) { - scriptDone(); - return true; - } - - return false; -} - -void AnimationView::doFrame() { - Scene &scene = _vm->_game->_scene; - - if (_resourceIndex == -1 || _currentAnimation->freeFlag()) { - if (++_resourceIndex == (int)_resources.size()) { - scriptDone(); - } else { - scene._frameStartTime = 0; - loadNextResource(); - } - } else if (_currentAnimation->getCurrentFrame() == 1) { - scene._cyclingActive = _nextCyclingActive; - } - - if (_currentAnimation) { - ++scene._frameStartTime; - _currentAnimation->update(); - _redrawFlag = true; - } -} - -void AnimationView::loadNextResource() { - Scene &scene = _vm->_game->_scene; - Palette &palette = *_vm->_palette; - ResourceEntry &resEntry = _resources[_resourceIndex]; - Common::Array paletteCycles; - - if (resEntry._bgFlag) - palette.resetGamePalette(1, 8); - - palette._mainPalette[253 * 3] = palette._mainPalette[253 * 3 + 1] - = palette._mainPalette[253 * 3 + 2] = 0xb4; - palette.setPalette(&palette._mainPalette[253 * 3], 253, 1); - - // Free any previous messages - scene._kernelMessages.reset(); - - // Handle the bars at the top/bottom - if (resEntry._showWhiteBars) { - // For animations the screen has been clipped to the middle 156 rows. - // So although it's slightly messy, bypass our screen class entirely, - // and draw the horizontal lines directly on the physiacl screen surface - Graphics::Surface *s = g_system->lockScreen(); - s->hLine(0, 20, MADS_SCREEN_WIDTH, 253); - s->hLine(0, 179, MADS_SCREEN_WIDTH, 253); - g_system->unlockScreen(); - } - - // Load the new animation - delete _currentAnimation; - _currentAnimation = Animation::init(_vm, &scene); - int flags = ANIMFLAG_ANIMVIEW | (resEntry._bgFlag ? ANIMFLAG_LOAD_BACKGROUND : 0); - _currentAnimation->load(scene._backgroundSurface, scene._depthSurface, - resEntry._resourceName, flags, &paletteCycles, _sceneInfo); - - // Signal for a screen refresh - scene._spriteSlots.fullRefresh(); - - // If a sound driver has been specified, then load the correct one - if (!_currentAnimation->_header._soundName.empty()) { - const char *chP = strchr(_currentAnimation->_header._soundName.c_str(), '.'); - assert(chP); - - // Handle both Rex naming (xxx.009) and naming in later games (e.g. xxx.ph9) - int driverNum = atoi(chP + 3); - // HACK for Dragon - if (_currentAnimation->_header._soundName == "#SOUND.DRG") - driverNum = 9; - _vm->_sound->init(driverNum); - } - - // Handle any manual setup - if (_currentAnimation->_header._manualFlag) { - _manualFrameNumber = _currentAnimation->_header._spritesIndex; - _manualSpriteSet = _currentAnimation->getSpriteSet(_manualFrameNumber); - } - - // Set the sound data for the animation - _vm->_sound->setEnabled(resEntry._soundFlag); - - Common::String dsrName = _currentAnimation->_header._dsrName; - if (!dsrName.empty()) - _vm->_audio->setSoundGroup(dsrName); - - // Start the new animation - _currentAnimation->startAnimation(0); - - // Handle the palette and cycling palette - scene._cyclingActive = false; - Common::copy(&palette._mainPalette[0], &palette._mainPalette[PALETTE_SIZE], - &palette._cyclingPalette[0]); - - _vm->_game->_fx = (ScreenTransition)resEntry._fx; - _nextCyclingActive = paletteCycles.size() > 0; - if (!_vm->_game->_fx) { - palette.setFullPalette(palette._mainPalette); - } - - scene.initPaletteAnimation(paletteCycles, _nextCyclingActive && !_vm->_game->_fx); -} - -void AnimationView::scriptDone() { - _breakFlag = true; - _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU; -} - -void AnimationView::processLines() { - if (_script.eos()) { - // end of script, end animation - scriptDone(); - return; - } - - while (!_script.eos()) { - // Get in next line - _currentLine.clear(); - char c; - while (!_script.eos() && (c = _script.readByte()) != '\n') { - if (c != '\r' && c != '\0') - _currentLine += c; - } - - // Process the line - while (!_currentLine.empty()) { - if (_currentLine.hasPrefix("-")) { - _currentLine.deleteChar(0); - - processCommand(); - } else { - // Get resource name - Common::String resName; - while (!_currentLine.empty() && (c = _currentLine[0]) != ' ') { - _currentLine.deleteChar(0); - resName += c; - } - - // Add resource into list along with any set state information - _resources.push_back(ResourceEntry(resName, _sfx, _soundFlag, - _bgLoadFlag, _showWhiteBars)); - - // Fx resets between resource entries - _sfx = 0; - } - - // Skip any spaces - while (_currentLine.hasPrefix(" ")) - _currentLine.deleteChar(0); - } - } -} - -void AnimationView::processCommand() { - // Get the command character - char commandChar = toupper(_currentLine[0]); - _currentLine.deleteChar(0); - - // Handle the command - switch (commandChar) { - case 'B': - _soundFlag = !_soundFlag; - break; - case 'H': - // -h[:ex] Disable EMS / XMS high memory support - if (_currentLine.hasPrefix(":")) - _currentLine.deleteChar(0); - while (_currentLine.hasPrefix("e") || _currentLine.hasPrefix("x")) - _currentLine.deleteChar(0); - break; - case 'O': - // -o:xxx Specify opening special effect - assert(_currentLine[0] == ':'); - _currentLine.deleteChar(0); - _sfx = getParameter(); - break; - case 'P': - // Switch to CONCAT mode, which is ignored anyway - break; - case 'R': { - // Resynch timer (always, beginning, never) - assert(_currentLine[0] == ':'); - _currentLine.deleteChar(0); - - char v = toupper(_currentLine[0]); - _currentLine.deleteChar(0); - if (v == 'N') - _resyncMode = NEVER; - else if (v == 'A') - _resyncMode = ALWAYS; - else if (v == 'B') - _resyncMode = BEGINNING; - else - error("Unknown parameter"); - break; - } - case 'W': - // Switch white bars being visible - _showWhiteBars = !_showWhiteBars; - break; - case 'X': - // Exit after animation finishes. Ignore - break; - case 'D': - // Unimplemented and ignored in the original. Ignore as well - break; - case 'Y': - // Reset palette on startup - _resetPalette = true; - break; - default: - error("Unknown command char: '%c'", commandChar); - } -} - -int AnimationView::getParameter() { - int result = 0; - - while (!_currentLine.empty()) { - char c = _currentLine[0]; - - if (c >= '0' && c <= '9') { - _currentLine.deleteChar(0); - result = result * 10 + (c - '0'); - } else { - break; - } - } - - return result; -} - -void AnimationView::checkResource(const Common::String &resourceName) { - //bool hasSuffix = false; - -} - -int AnimationView::scanResourceIndex(const Common::String &resourceName) { - int foundIndex = -1; - - if (_v1) { - const char *chP = strchr(resourceName.c_str(), '\\'); - if (!chP) { - chP = strchr(resourceName.c_str(), '*'); - } - - Common::String resName = chP ? Common::String(chP + 1) : resourceName; - - if (_v2 != 3) { - assert(_resIndex.size() == 0); - } - - // Scan for the resource name - for (uint resIndex = 0; resIndex < _resIndex.size(); ++resIndex) { - ResIndexEntry &resEntry = _resIndex[resIndex]; - if (resEntry._resourceName.compareToIgnoreCase(resourceName)) { - foundIndex = resIndex; - break; - } - } - } - - if (foundIndex >= 0) { - // TODO - } - return -1; -} - - } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h index c05c87258e..29777a7a7c 100644 --- a/engines/mads/nebular/menu_nebular.h +++ b/engines/mads/nebular/menu_nebular.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/menu_views.h" #include "mads/msurface.h" #include "mads/nebular/dialogs_nebular.h" @@ -36,27 +37,6 @@ namespace Nebular { enum MADSGameAction { START_GAME, RESUME_GAME, SHOW_INTRO, CREDITS, QUOTES, EXIT }; -class MenuView: public FullScreenDialog { -protected: - bool _breakFlag; - bool _redrawFlag; - - virtual void doFrame() = 0; - - virtual void display(); - - /** - * Event handler - */ - virtual bool onEvent(Common::Event &event); -public: - MenuView(MADSEngine *vm); - - virtual ~MenuView() {} - - virtual void show(); -}; - class MainMenu: public MenuView { private: SpriteAsset *_menuItems[7]; @@ -148,174 +128,6 @@ public: void show(); }; -struct TextLine { - Common::Point _pos; - Common::String _line; - int _textDisplayIndex; -}; - -/** - * Scrolling text view - */ -class TextView : public MenuView { -private: - static char _resourceName[100]; - - bool _animating; - Common::Array _textLines; - Common::Point _pan; - int _panSpeed; - MSurface _spareScreens[4]; - int _scrollCount; - int _lineY; - uint32 _scrollTimeout; - int _panCountdown; - int _translationX; - Common::File _script; - char _currentLine[80]; - MSurface *_spareScreen; - Font *_font; -private: - /** - * Load the text resource - */ - void load(); - - /** - * Process the lines - */ - void processLines(); - - /** - * Process a command from the script file - */ - void processCommand(); - - /** - * Process text from the script file - */ - void processText(); - - /** - * Get a parameter from line - */ - int getParameter(const char **paramP); - - /** - * Called when the script is finished - */ - void scriptDone(); - - /** - * Reset the game palette - */ - void resetPalette(); -protected: - virtual void display(); - - virtual void doFrame(); -public: - /** - * Queue the given text resource for display - */ - static void execute(MADSEngine *vm, const Common::String &resName); - - TextView(MADSEngine *vm); - - virtual ~TextView(); -}; - -enum ResyncMode { NEVER, ALWAYS, BEGINNING }; - -struct ResourceEntry { - Common::String _resourceName; - int _fx; - bool _soundFlag; - bool _bgFlag; - bool _showWhiteBars; - - ResourceEntry() {} - ResourceEntry(const Common::String &resName, int fx, bool soundFlag, - bool bgFlag, bool showWhiteBars) { - _resourceName = resName; - _fx = fx; - _soundFlag = soundFlag; - _bgFlag = bgFlag; - _showWhiteBars = showWhiteBars; - } -}; - -struct ResIndexEntry { - int _id; - int _v; - Common::String _resourceName; - - ResIndexEntry() {} -}; - -/** -* Animation cutscene view -*/ -class AnimationView : public MenuView { -private: - static char _resourceName[100]; - - Common::File _script; - uint32 _previousUpdate; - Common::String _currentLine; - bool _soundDriverLoaded; - bool _resetPalette; - ResyncMode _resyncMode; - int _sfx; - bool _soundFlag; - bool _bgLoadFlag; - bool _showWhiteBars; - Common::Array _resources; - Common::Array _resIndex; - int _v1; - int _v2; - int _resourceIndex; - SceneInfo *_sceneInfo; - Animation *_currentAnimation; - int _manualFrameNumber; - SpriteAsset *_manualSpriteSet; - int _manualStartFrame, _manualEndFrame; - int _manualFrame2; - int _animFrameNumber; - bool _nextCyclingActive; -private: - void checkResource(const Common::String &resourceName); - - int scanResourceIndex(const Common::String &resourceName); - - void load(); - - void processLines(); - - void processCommand(); - - int getParameter(); - - void scriptDone(); - - void loadNextResource(); -protected: - virtual void display(); - - virtual void doFrame(); - - virtual bool onEvent(Common::Event &event); -public: - /** - * Queue the given text resource for display - */ - static void execute(MADSEngine *vm, const Common::String &resName); - - AnimationView(MADSEngine *vm); - - virtual ~AnimationView(); -}; - } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 63ad675abf7cc8585da30ef97bebe0c6cd502a58 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Sep 2015 21:18:19 +0200 Subject: MADS: Allow multiple animations for Phantom and later games --- engines/mads/nebular/nebular_scenes1.cpp | 26 +++---- engines/mads/nebular/nebular_scenes2.cpp | 84 +++++++++++----------- engines/mads/nebular/nebular_scenes3.cpp | 76 ++++++++++---------- engines/mads/nebular/nebular_scenes4.cpp | 72 +++++++++---------- engines/mads/nebular/nebular_scenes5.cpp | 46 ++++++------ engines/mads/nebular/nebular_scenes6.cpp | 118 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes7.cpp | 84 +++++++++++----------- engines/mads/nebular/nebular_scenes8.cpp | 36 +++++----- 8 files changed, 271 insertions(+), 271 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index fd97f71727..d5e1fc08f7 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -258,32 +258,32 @@ void Scene101::step() { break; } - if (_scene->_activeAnimation != nullptr) { - if ((_scene->_activeAnimation->getCurrentFrame() >= 6) && (_messageNum == 0)) { + if (_scene->_animation[0] != nullptr) { + if ((_scene->_animation[0]->getCurrentFrame() >= 6) && (_messageNum == 0)) { _messageNum++; _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(49)); _posY += 14; } - if ((_scene->_activeAnimation->getCurrentFrame() >= 7) && (_messageNum == 1)) { + if ((_scene->_animation[0]->getCurrentFrame() >= 7) && (_messageNum == 1)) { _messageNum++; _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(54)); _posY += 14; } - if ((_scene->_activeAnimation->getCurrentFrame() >= 10) && (_messageNum == 2)) { + if ((_scene->_animation[0]->getCurrentFrame() >= 10) && (_messageNum == 2)) { _messageNum++; _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(55)); _posY += 14; } - if ((_scene->_activeAnimation->getCurrentFrame() >= 17) && (_messageNum == 3)) { + if ((_scene->_animation[0]->getCurrentFrame() >= 17) && (_messageNum == 3)) { _messageNum++; _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(56)); _posY += 14; } - if ((_scene->_activeAnimation->getCurrentFrame() >= 20) && (_messageNum == 4)) { + if ((_scene->_animation[0]->getCurrentFrame() >= 20) && (_messageNum == 4)) { _messageNum++; _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(50)); _posY += 14; @@ -1782,7 +1782,7 @@ void Scene104::step() { if ((_game._player._special > 0) && _game._player._stepEnabled) _game._player._stepEnabled = false; - if (_kargShootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + if (_kargShootingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); _kargShootingFl = false; } @@ -2079,7 +2079,7 @@ void Scene106::step() { } } - if (_firstEmergingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + if (_firstEmergingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) { _firstEmergingFl = false; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); } @@ -2263,7 +2263,7 @@ void Scene107::enter() { } void Scene107::step() { - if (_shootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + if (_shootingFl && (_scene->_animation[0]->getCurrentFrame() >= 19)) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); _shootingFl = false; } @@ -2919,7 +2919,7 @@ void Scene110::actions() { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1); - _scene->_activeAnimation->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer); + _scene->_animation[0]->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer); _game._player._stepEnabled = false; _game._player._visible = false; break; @@ -3066,7 +3066,7 @@ void Scene111::step() { if (_game._trigger == 73) _vm->_sound->command(37); - if (_rexDivingFl && (_scene->_activeAnimation->getCurrentFrame() >= 9)) { + if (_rexDivingFl && (_scene->_animation[0]->getCurrentFrame() >= 9)) { _vm->_sound->command(36); _rexDivingFl = false; } @@ -3138,8 +3138,8 @@ void Scene112::enter() { } void Scene112::step() { - if ((_scene->_activeAnimation != nullptr) && (_game._storyMode == STORYMODE_NICE)) { - if (_scene->_activeAnimation->getCurrentFrame() >= 54) { + if ((_scene->_animation[0] != nullptr) && (_game._storyMode == STORYMODE_NICE)) { + if (_scene->_animation[0]->getCurrentFrame() >= 54) { _scene->freeAnimation(); _game._trigger = 70; } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 1cbd6f56ef..ad15f83707 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -484,7 +484,7 @@ void Scene202::enter() { } _scene->loadAnimation(formAnimName('M', -1), 71); - _scene->_activeAnimation->setCurrentFrame(200); + _scene->_animation[0]->setCurrentFrame(200); } else { if (_ladderTopFl) { _game._player._visible = false; @@ -596,7 +596,7 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { + if (!_scene->_animation[0] && (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_ladderTopFl) @@ -615,11 +615,11 @@ void Scene202::step() { } } - if (!_scene->_activeAnimation) + if (!_scene->_animation[0]) return; if (_waitingMeteoFl) { - if (_scene->_activeAnimation->getCurrentFrame() >= 200) { + if (_scene->_animation[0]->getCurrentFrame() >= 200) { if ((_globals[kMeteorologistWatch] == METEOROLOGIST_TOWER) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; } else { @@ -628,7 +628,7 @@ void Scene202::step() { } } - if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_meteoFrame != _scene->_activeAnimation->getCurrentFrame())) { + if ((_scene->_animation[0]->getCurrentFrame() == 160) && (_meteoFrame != _scene->_animation[0]->getCurrentFrame())) { Common::Point msgPos; int msgFlag; if (!_ladderTopFl) { @@ -647,15 +647,15 @@ void Scene202::step() { _toTeleportFl = true; } - if (_scene->_activeAnimation->getCurrentFrame() == _meteoFrame) { + if (_scene->_animation[0]->getCurrentFrame() == _meteoFrame) { return; } - _meteoFrame = _scene->_activeAnimation->getCurrentFrame(); + _meteoFrame = _scene->_animation[0]->getCurrentFrame(); int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; - switch (_scene->_activeAnimation->getCurrentFrame()) { + switch (_scene->_animation[0]->getCurrentFrame()) { case 42: case 77: case 96: @@ -693,8 +693,8 @@ void Scene202::step() { break; } - if (frameStep >= 0 && frameStep != _scene->_activeAnimation->getCurrentFrame() + 1) { - _scene->_activeAnimation->setCurrentFrame(frameStep); + if (frameStep >= 0 && frameStep != _scene->_animation[0]->getCurrentFrame() + 1) { + _scene->_animation[0]->setCurrentFrame(frameStep); _meteoFrame = frameStep; } } @@ -797,7 +797,7 @@ void Scene202::actions() { _scene->_nextSceneId = 203; } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_NORTH)) { if (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) { - if (_scene->_activeAnimation) + if (_scene->_animation[0]) _globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT; else _globals[kMeteorologistStatus] = METEOROLOGIST_ABSENT; @@ -890,7 +890,7 @@ void Scene202::actions() { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); - if (_scene->_activeAnimation) { + if (_scene->_animation[0]) { _waitingMeteoFl = true; _globals[kMeteorologistWatch] = METEOROLOGIST_GROUND; } else { @@ -898,7 +898,7 @@ void Scene202::actions() { } break; case 2: - if (!_scene->_activeAnimation && !_meteorologistSpecial) { + if (!_scene->_animation[0] && !_meteorologistSpecial) { _vm->_dialogs->show(20222); } _scene->_sequences.remove(_globals._sequenceIndexes[10]); @@ -932,13 +932,13 @@ void Scene202::actions() { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - if (_scene->_activeAnimation) { - if (_scene->_activeAnimation->getCurrentFrame() > 200) { + if (_scene->_animation[0]) { + if (_scene->_animation[0]->getCurrentFrame() > 200) { _scene->_sequences.addTimer(120, 2); } else { _waitingMeteoFl = true; _globals[kMeteorologistWatch] = METEOROLOGIST_GONE; - if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { + if ((_scene->_animation[0]->getCurrentFrame() >= 44) && (_scene->_animation[0]->getCurrentFrame() <= 75)) { _scene->_kernelMessages.reset(); int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); _scene->_kernelMessages.setQuoted(msgIndex, 4, false); @@ -952,7 +952,7 @@ void Scene202::actions() { } break; case 2: - if (!_scene->_activeAnimation) + if (!_scene->_animation[0]) _vm->_dialogs->show(20222); _meteorologistSpecial = false; _scene->_sequences.remove(_globals._sequenceIndexes[10]); @@ -1227,7 +1227,7 @@ void Scene205::enter() { if (_globals[kSexOfRex] != SEX_MALE) { _scene->loadAnimation(formAnimName('a', -1)); - _scene->_activeAnimation->_resetFlag = true; + _scene->_animation[0]->_resetFlag = true; } else { _beingKicked = true; _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); @@ -1379,8 +1379,8 @@ void Scene205::actions() { _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], -1); _vm->_sound->command(27); } else if (_game._trigger == 1) { - if (_scene->_activeAnimation != nullptr) - _scene->_activeAnimation->resetSpriteSetsCount(); + if (_scene->_animation[0] != nullptr) + _scene->_animation[0]->resetSpriteSetsCount(); _vm->_dialogs->show(20516); _scene->_reloadSceneFlag = true; @@ -1746,9 +1746,9 @@ void Scene208::enter() { } void Scene208::step() { - if (_boundingFl && _scene->_activeAnimation && - (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { - _rhotundaTime = _scene->_activeAnimation->getCurrentFrame(); + if (_boundingFl && _scene->_animation[0] && + (_rhotundaTime <= _scene->_animation[0]->getCurrentFrame())) { + _rhotundaTime = _scene->_animation[0]->getCurrentFrame(); if (_rhotundaTime == 125) _scene->_sequences.remove(_globals._sequenceIndexes[4]); @@ -4064,7 +4064,7 @@ void Scene210::setDialogNode(int node) { _vm->_palette->lock(); _scene->_kernelMessages.reset(); _scene->freeAnimation(); - _scene->_activeAnimation = nullptr; + _scene->_animation[0] = nullptr; _scene->resetScene(); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); @@ -4263,8 +4263,8 @@ void Scene210::enter() { } restoreDialogNode(_curDialogNode, quote, number); - if (_scene->_activeAnimation) - _scene->_activeAnimation->setCurrentFrame(131); + if (_scene->_animation[0]) + _scene->_animation[0]->setCurrentFrame(131); } _vm->_palette->setEntry(252, 63, 63, 10); @@ -4274,9 +4274,9 @@ void Scene210::enter() { } void Scene210::step() { - if ((_twinkleAnimationType == 1) && _scene->_activeAnimation) { - if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) { - _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_twinkleAnimationType == 1) && _scene->_animation[0]) { + if (_twinklesCurrentFrame != _scene->_animation[0]->getCurrentFrame()) { + _twinklesCurrentFrame = _scene->_animation[0]->getCurrentFrame(); int reset_frame = -1; int random = _vm->getRandomNumber(1, 1000); @@ -4396,8 +4396,8 @@ void Scene210::step() { } if (reset_frame >= 0) { - if (reset_frame != _scene->_activeAnimation->getCurrentFrame()) { - _scene->_activeAnimation->setCurrentFrame(reset_frame); + if (reset_frame != _scene->_animation[0]->getCurrentFrame()) { + _scene->_animation[0]->setCurrentFrame(reset_frame); _twinklesCurrentFrame = reset_frame; } @@ -4411,9 +4411,9 @@ void Scene210::step() { } } - if ((_twinkleAnimationType == 2) && _scene->_activeAnimation) { - if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) { - _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_twinkleAnimationType == 2) && _scene->_animation[0]) { + if (_twinklesCurrentFrame != _scene->_animation[0]->getCurrentFrame()) { + _twinklesCurrentFrame = _scene->_animation[0]->getCurrentFrame(); int reset_frame = -1; if (_twinklesCurrentFrame == 53) { @@ -4422,8 +4422,8 @@ void Scene210::step() { } else if ((_twinklesCurrentFrame == 75) && _shouldTalk) reset_frame = 60; - if ((reset_frame >= 0) && (reset_frame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(reset_frame); + if ((reset_frame >= 0) && (reset_frame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(reset_frame); _twinklesCurrentFrame = reset_frame; } } @@ -4646,7 +4646,7 @@ void Scene211::enter() { _game._player._stepEnabled = false; _game._player._visible = false; _scene->loadAnimation(formAnimName('A', -1), 100); - _scene->_activeAnimation->setCurrentFrame(169); + _scene->_animation[0]->setCurrentFrame(169); } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) { _game._player._playerPos = Common::Point(310, 31); _game._player._facing = FACING_SOUTHWEST; @@ -4725,8 +4725,8 @@ void Scene211::step() { } } - if (_ambushFl && (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame)) { - _monkeyFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_ambushFl && (_scene->_animation[0]->getCurrentFrame() > _monkeyFrame)) { + _monkeyFrame = _scene->_animation[0]->getCurrentFrame(); switch (_monkeyFrame) { case 2: { int msgIndex = _scene->_kernelMessages.add(Common::Point(12, 4), 0xFDFC, 0, 0, 60, _game.getQuote(157)); @@ -4798,9 +4798,9 @@ void Scene211::step() { _wakeFl = false; } - if (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame) { - _monkeyFrame = _scene->_activeAnimation->getCurrentFrame(); - switch (_scene->_activeAnimation->getCurrentFrame()) { + if (_scene->_animation[0]->getCurrentFrame() > _monkeyFrame) { + _monkeyFrame = _scene->_animation[0]->getCurrentFrame(); + switch (_scene->_animation[0]->getCurrentFrame()) { case 177: { int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(165)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 5a6edbf995..717dd85de7 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -293,8 +293,8 @@ void Scene302::step() { if (_game._trigger == 71) _scene->_nextSceneId = 303; - if ((_scene->_activeAnimation != nullptr) && (_scene->_activeAnimation->getCurrentFrame() != _oldFrame)) { - _oldFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_scene->_animation[0] != nullptr) && (_scene->_animation[0]->getCurrentFrame() != _oldFrame)) { + _oldFrame = _scene->_animation[0]->getCurrentFrame(); if (_oldFrame == 147) { _game._objects.setRoom(OBJ_POISON_DARTS, 1); _game._objects.setRoom(OBJ_BLOWGUN, 1); @@ -828,23 +828,23 @@ void Scene307::enter() { void Scene307::step() { handleForceField(&_forceField, &_globals._spriteIndexes[0]); - if ((_animationMode == 1) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() == 126) { + if ((_animationMode == 1) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() == 126) { _forceField._flag = false; _vm->_sound->command(5); } - if (_scene->_activeAnimation->getCurrentFrame() == 194) { + if (_scene->_animation[0]->getCurrentFrame() == 194) { _forceField._flag = true; _vm->_sound->command(24); } } - if ((_animationMode == 2) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() == 54) + if ((_animationMode == 2) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() == 54) _forceField._flag = false; - if (_scene->_activeAnimation->getCurrentFrame() == 150) { + if (_scene->_animation[0]->getCurrentFrame() == 150) { _game._player._visible = false; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; } @@ -869,7 +869,7 @@ void Scene307::step() { } _lastFrameTime = _scene->_frameStartTime; - if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_activeAnimation == nullptr) + if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_animation[0] == nullptr) && (_game._screenObjects._inputMode != kInputConversation) && _globals[kMetBuddyBeast] && !_activePrisonerFl) { if (!_game._objects.isInInventory(OBJ_SCALPEL) && !_grateOpenedFl) { _game._player._stepEnabled = false; @@ -879,7 +879,7 @@ void Scene307::step() { _scene->loadAnimation(formAnimName('b', -1), 70); } _guardTime = 0; - } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != kInputConversation) && (_scene->_activeAnimation == nullptr) && !_activePrisonerFl) { + } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != kInputConversation) && (_scene->_animation[0] == nullptr) && !_activePrisonerFl) { if (!_globals[kMetBuddyBeast]) { int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(_prisonerMessageId)); _scene->_kernelMessages.setQuoted(idx, 4, true); @@ -1380,9 +1380,9 @@ void Scene309::enter() { _game._player._stepEnabled = false; _scene->loadAnimation(formAnimName('a', -1), 60); - _characterSpriteIndexes[0] = _scene->_activeAnimation->_spriteListIndexes[2]; - _characterSpriteIndexes[1] = _scene->_activeAnimation->_spriteListIndexes[2]; - _characterSpriteIndexes[2] = _scene->_activeAnimation->_spriteListIndexes[1]; + _characterSpriteIndexes[0] = _scene->_animation[0]->_spriteListIndexes[2]; + _characterSpriteIndexes[1] = _scene->_animation[0]->_spriteListIndexes[2]; + _characterSpriteIndexes[2] = _scene->_animation[0]->_spriteListIndexes[1]; _messagesIndexes[0] = -1; _messagesIndexes[1] = -1; @@ -1404,9 +1404,9 @@ void Scene309::step() { if (_game._trigger == 62) _messagesIndexes[2] = -1; - if (_scene->_activeAnimation != nullptr) { - if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { - _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_scene->_animation[0] != nullptr) { + if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) { + _lastFrame = _scene->_animation[0]->getCurrentFrame(); if (_lastFrame == 39) { _messagesIndexes[0] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 61, 210, _game.getQuote(348)); _messagesIndexes[1] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 0, 210, _game.getQuote(349)); @@ -1419,15 +1419,15 @@ void Scene309::step() { if (_messagesIndexes[charIdx] >= 0) { bool match = false; int j = -1; - for (j = _scene->_activeAnimation->_oldFrameEntry; j < _scene->_activeAnimation->_header._frameEntriesCount; j++) { - if (_scene->_activeAnimation->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) { + for (j = _scene->_animation[0]->_oldFrameEntry; j < _scene->_animation[0]->_header._frameEntriesCount; j++) { + if (_scene->_animation[0]->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) { match = true; break; } } if (match) { - SpriteSlotSubset *curSpriteSlot = &_scene->_activeAnimation->_frameEntries[j]._spriteSlot; + SpriteSlotSubset *curSpriteSlot = &_scene->_animation[0]->_frameEntries[j]._spriteSlot; _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.x = curSpriteSlot->_position.x; _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.y = curSpriteSlot->_position.y - (50 + (14 * ((charIdx == 0) ? 2 : 1))); } @@ -2602,7 +2602,7 @@ void Scene318::enter() { if (_globals[kAfterHavoc]) { _scene->loadAnimation(formAnimName('f', -1)); - _scene->_activeAnimation->_resetFlag = true; + _scene->_animation[0]->_resetFlag = true; } else if (!_globals[kHasSeenProfPyro]) { _scene->_hotspots.activate(NOUN_PROFESSORS_GURNEY, false); _scene->_hotspots.activate(NOUN_PROFESSOR, false); @@ -2705,9 +2705,9 @@ void Scene318::enter() { } void Scene318::step() { - if ((_scene->_activeAnimation != nullptr) && (_animMode == 2)) { - if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { - _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_scene->_animation[0] != nullptr) && (_animMode == 2)) { + if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) { + _lastFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; switch (_lastFrame) { @@ -2759,8 +2759,8 @@ void Scene318::step() { break; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _lastFrame = nextFrame; } } @@ -3185,11 +3185,11 @@ void Scene319::enter() { } void Scene319::step() { - if (_scene->_activeAnimation == nullptr) + if (_scene->_animation[0] == nullptr) return; - if (_animFrame != _scene->_activeAnimation->getCurrentFrame()) { - _animFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_animFrame != _scene->_animation[0]->getCurrentFrame()) { + _animFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; if (_animMode == 1) { switch (_animFrame) { @@ -3305,8 +3305,8 @@ void Scene319::step() { if ((_animMode == 4) && (_animFrame == 16)) _vm->_screen._shakeCountdown = 80; - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _animFrame = nextFrame; } } @@ -3320,11 +3320,11 @@ void Scene319::step() { _scene->freeAnimation(); _scene->loadAnimation(formAnimName('b', 0)); if (_nextAction1 == 3) - _scene->_activeAnimation->setCurrentFrame(85); + _scene->_animation[0]->setCurrentFrame(85); else if (_nextAction1 == 1) - _scene->_activeAnimation->setCurrentFrame(40); + _scene->_animation[0]->setCurrentFrame(40); - _animFrame = _scene->_activeAnimation->getCurrentFrame(); + _animFrame = _scene->_animation[0]->getCurrentFrame(); _slacheTalkingFl = true; _vm->_screen._shakeCountdown = 1; @@ -3710,9 +3710,9 @@ void Scene320::enter() { } void Scene320::step() { - if (_scene->_activeAnimation != nullptr) { - if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { - _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_scene->_animation[0] != nullptr) { + if (_lastFrame != _scene->_animation[0]->getCurrentFrame()) { + _lastFrame = _scene->_animation[0]->getCurrentFrame(); switch (_lastFrame) { case 95: _blinkFl = true; @@ -3892,8 +3892,8 @@ void Scene321::enter() { } void Scene321::step() { - if (_scene->_activeAnimation != nullptr) { - if ((_scene->_activeAnimation->getCurrentFrame() >= 260) && (_globals[kSexOfRex] == REX_MALE) && (_game._storyMode >= STORYMODE_NICE)) + if (_scene->_animation[0] != nullptr) { + if ((_scene->_animation[0]->getCurrentFrame() >= 260) && (_globals[kSexOfRex] == REX_MALE) && (_game._storyMode >= STORYMODE_NICE)) _scene->_nextSceneId = 316; } diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index c981f6a6e4..19e1fc792e 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -876,7 +876,7 @@ void Scene402::enter() { _refuseAlienLiquor = false; _scene->loadAnimation(Resources::formatName(402, 'd', 1, EXT_AA, "")); - _scene->_activeAnimation->_resetFlag = true; + _scene->_animation[0]->_resetFlag = true; _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); @@ -1536,43 +1536,43 @@ void Scene402::step() { if (_game._trigger == 32) _rightWomanMoving = false; - if (_scene->_activeAnimation->getCurrentFrame() == 1) { + if (_scene->_animation[0]->getCurrentFrame() == 1) { switch (_vm->getRandomNumber(1, 50)) { case 1: - _scene->_activeAnimation->setCurrentFrame(2); + _scene->_animation[0]->setCurrentFrame(2); break; case 2: - _scene->_activeAnimation->setCurrentFrame(7); + _scene->_animation[0]->setCurrentFrame(7); break; case 3: - _scene->_activeAnimation->setCurrentFrame(11); + _scene->_animation[0]->setCurrentFrame(11); break; default: - _scene->_activeAnimation->setCurrentFrame(0); + _scene->_animation[0]->setCurrentFrame(0); break; } } - if ((_scene->_activeAnimation->getCurrentFrame() == 4) && (_drinkTimer < 10)) { + if ((_scene->_animation[0]->getCurrentFrame() == 4) && (_drinkTimer < 10)) { ++ _drinkTimer; - _scene->_activeAnimation->setCurrentFrame(3); + _scene->_animation[0]->setCurrentFrame(3); } if (_drinkTimer == 10) { _drinkTimer = 0; - _scene->_activeAnimation->setCurrentFrame(4); - _scene->_activeAnimation->_currentFrame = 5; + _scene->_animation[0]->setCurrentFrame(4); + _scene->_animation[0]->_currentFrame = 5; } - switch (_scene->_activeAnimation->getCurrentFrame()) { + switch (_scene->_animation[0]->getCurrentFrame()) { case 6: case 10: case 14: - _scene->_activeAnimation->setCurrentFrame(0); + _scene->_animation[0]->setCurrentFrame(0); break; default: @@ -3126,36 +3126,36 @@ void Scene410::enter() { sceneEntrySound(); _scene->loadAnimation(Resources::formatName(410, 'r', -1, EXT_AA, "")); - _scene->_activeAnimation->_resetFlag = true; + _scene->_animation[0]->_resetFlag = true; } void Scene410::step() { - if (_scene->_activeAnimation->getCurrentFrame() == 1) { + if (_scene->_animation[0]->getCurrentFrame() == 1) { if (_vm->getRandomNumber(1, 30) == 1) - _scene->_activeAnimation->setCurrentFrame(2); + _scene->_animation[0]->setCurrentFrame(2); else - _scene->_activeAnimation->setCurrentFrame(0); + _scene->_animation[0]->setCurrentFrame(0); } - if (_scene->_activeAnimation->getCurrentFrame() == 9) { + if (_scene->_animation[0]->getCurrentFrame() == 9) { if (_vm->getRandomNumber(1, 30) == 1) - _scene->_activeAnimation->setCurrentFrame(10); + _scene->_animation[0]->setCurrentFrame(10); else - _scene->_activeAnimation->setCurrentFrame(8); + _scene->_animation[0]->setCurrentFrame(8); } - if (_scene->_activeAnimation->getCurrentFrame() == 5) { + if (_scene->_animation[0]->getCurrentFrame() == 5) { if (_vm->getRandomNumber(1, 30) == 1) - _scene->_activeAnimation->setCurrentFrame(6); + _scene->_animation[0]->setCurrentFrame(6); else - _scene->_activeAnimation->setCurrentFrame(4); + _scene->_animation[0]->setCurrentFrame(4); } - if (_scene->_activeAnimation->getCurrentFrame() == 3) { + if (_scene->_animation[0]->getCurrentFrame() == 3) { if (_vm->getRandomNumber(1, 2) == 1) - _scene->_activeAnimation->setCurrentFrame(4); + _scene->_animation[0]->setCurrentFrame(4); else // == 2 - _scene->_activeAnimation->setCurrentFrame(8); + _scene->_animation[0]->setCurrentFrame(8); } } @@ -3491,7 +3491,7 @@ void Scene411::handleDialog() { _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; _game._player._visible = false; _game._player._stepEnabled = false; - _scene->_activeAnimation->setCurrentFrame(_resetFrame); + _scene->_animation[0]->setCurrentFrame(_resetFrame); } _scene->_kernelMessages.reset(); _newQuantity = computeQuoteAndQuantity(); @@ -3661,16 +3661,16 @@ void Scene411::enter() { } _scene->loadAnimation(formAnimName('a', -1)); - _scene->_activeAnimation->setCurrentFrame(128); + _scene->_animation[0]->setCurrentFrame(128); _makeMushroomCloud = false; _killRox = false; } void Scene411::step() { - if (_scene->_activeAnimation != nullptr) { - if (_curAnimationFrame != _scene->_activeAnimation->getCurrentFrame()) { - _curAnimationFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_scene->_animation[0] != nullptr) { + if (_curAnimationFrame != _scene->_animation[0]->getCurrentFrame()) { + _curAnimationFrame = _scene->_animation[0]->getCurrentFrame(); _resetFrame = -1; switch (_curAnimationFrame) { @@ -3738,14 +3738,14 @@ void Scene411::step() { break; } - if ((_resetFrame >= 0) && (_resetFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(_resetFrame); + if ((_resetFrame >= 0) && (_resetFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(_resetFrame); _curAnimationFrame = _resetFrame; } } } - if (_scene->_activeAnimation->getCurrentFrame() == 86) + if (_scene->_animation[0]->getCurrentFrame() == 86) _vm->_sound->command(59); } @@ -4113,10 +4113,10 @@ void Scene413::enter() { } void Scene413::step() { - if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 38) - _scene->_activeAnimation->setCurrentFrame(37); + if (_scene->_animation[0] && _scene->_animation[0]->getCurrentFrame() == 38) + _scene->_animation[0]->setCurrentFrame(37); - if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 21 && _canMove) { + if (_scene->_animation[0] && _scene->_animation[0]->getCurrentFrame() == 21 && _canMove) { _vm->_sound->command(27); _canMove = false; } diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 95eb429193..092ddeb3f7 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -722,9 +722,9 @@ void Scene504::enter() { } void Scene504::step() { - if ((_carAnimationMode == 1) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carAnimationMode == 1) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame; if (_carFrame == 1) @@ -732,8 +732,8 @@ void Scene504::step() { else nextFrame = -1; - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _carFrame = nextFrame; } } @@ -943,15 +943,15 @@ void Scene505::enter() { _game._player._stepEnabled = false; _frame = -1; _scene->loadAnimation(formAnimName('a', -1)); - _scene->_activeAnimation->setCurrentFrame(86); + _scene->_animation[0]->setCurrentFrame(86); sceneEntrySound(); _vm->_sound->command(16); } void Scene505::step() { - if (_frame != _scene->_activeAnimation->getCurrentFrame()) { - _frame = _scene->_activeAnimation->getCurrentFrame(); + if (_frame != _scene->_animation[0]->getCurrentFrame()) { + _frame = _scene->_animation[0]->getCurrentFrame(); int resetFrame = -1; switch (_frame) { @@ -1088,8 +1088,8 @@ void Scene505::step() { break; } - if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(resetFrame); + if ((resetFrame >= 0) && (resetFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(resetFrame); _frame = resetFrame; } } @@ -1254,7 +1254,7 @@ void Scene506::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -1943,9 +1943,9 @@ void Scene511::enter() { } void Scene511::step() { - if ((_lineAnimationMode == 1) && _scene->_activeAnimation) { - if (_lineFrame != _scene->_activeAnimation->getCurrentFrame()) { - _lineFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_lineAnimationMode == 1) && _scene->_animation[0]) { + if (_lineFrame != _scene->_animation[0]->getCurrentFrame()) { + _lineFrame = _scene->_animation[0]->getCurrentFrame(); int resetFrame = -1; if ((_lineAnimationPosition == 2) && (_lineFrame == 14)) @@ -1961,8 +1961,8 @@ void Scene511::step() { resetFrame = 2; } - if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(resetFrame); + if ((resetFrame >= 0) && (resetFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(resetFrame); _lineFrame = resetFrame; } } @@ -1971,7 +1971,7 @@ void Scene511::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -2009,7 +2009,7 @@ void Scene511::preActions() { _scene->loadAnimation(formAnimName('R',2), 1); } else if (_game._trigger == 1) { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _game._objects.setRoom(OBJ_FISHING_LINE, 1); _handingLine = false; _game._player._stepEnabled = true; @@ -2118,8 +2118,8 @@ void Scene511::actions() { _globals[kLineStatus] = 3; _game._player._stepEnabled = true; - if (_scene->_activeAnimation) - _scene->_activeAnimation->eraseSprites(); + if (_scene->_animation[0]) + _scene->_animation[0]->eraseSprites(); _game._player.update(); } } @@ -2434,8 +2434,8 @@ void Scene512::actions() { _vm->_dialogs->show(51225); else if (_action.isAction(VERB_LOOK, NOUN_PADLOCK_KEY) && _game._objects.isInRoom(OBJ_PADLOCK_KEY)) _vm->_dialogs->show(51215); - else if (_action.isAction(VERB_LOOK, NOUN_FISHING_ROD) && (!_scene->_activeAnimation || - _scene->_activeAnimation->getCurrentFrame() == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_ROD) && (!_scene->_animation[0] || + _scene->_animation[0]->getCurrentFrame() == 4)) _vm->_dialogs->show(51216); else if (_action.isAction(VERB_LOOK, NOUN_SHIPS_WHEEL)) _vm->_dialogs->show(51218); @@ -2570,7 +2570,7 @@ void Scene513::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index d97e37ea0b..5b7dae4489 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -124,7 +124,7 @@ void Scene601::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(30, 71); break; @@ -431,7 +431,7 @@ void Scene602::actions() { case 1: { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _lastSpriteIdx = _globals._spriteIndexes[3]; _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, -1); _scene->_sequences.setDepth(_lastSequenceIdx, 14); @@ -775,7 +775,7 @@ void Scene604::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(30, 71); break; @@ -797,9 +797,9 @@ void Scene604::step() { break; } - if (_monsterActive && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _monsterFrame) { - _monsterFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_monsterActive && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _monsterFrame) { + _monsterFrame = _scene->_animation[0]->getCurrentFrame(); int nextMonsterFrame = -1; switch (_monsterFrame) { @@ -837,7 +837,7 @@ void Scene604::step() { } if ((nextMonsterFrame >= 0) && (nextMonsterFrame != _monsterFrame)) { - _scene->_activeAnimation->setCurrentFrame(nextMonsterFrame); + _scene->_animation[0]->setCurrentFrame(nextMonsterFrame); _monsterFrame = nextMonsterFrame; } } @@ -1297,7 +1297,7 @@ void Scene607::step() { switch (_game._trigger) { case 80: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 81); break; @@ -1331,7 +1331,7 @@ void Scene607::handleThrowingBone() { case 1: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; if (_animationMode != 1) _scene->_hotspots.activate(NOUN_OBNOXIOUS_DOG, false); @@ -1605,7 +1605,7 @@ void Scene608::restoreAnimations() { _scene->_sequences.remove(_globals._sequenceIndexes[6]); _scene->_sequences.remove(_globals._sequenceIndexes[7]); _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(6); + _scene->_animation[0]->setCurrentFrame(6); } } @@ -1757,7 +1757,7 @@ void Scene608::enter() { int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(6); + _scene->_animation[0]->setCurrentFrame(6); } else if (_globals[kCarStatus] == CAR_SQUASHES_DOG) { _carMode = 2; _dogDeathMode = 0; @@ -1927,13 +1927,13 @@ void Scene608::step() { _animationMode = 0; } - if ((_carMode == 4) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 4) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); if (_carFrame == 10) { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; } else if (_carFrame == 56) { resetDogVariables(); _animationMode = 0; @@ -1942,12 +1942,12 @@ void Scene608::step() { } } - if ((_carMode == 5) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 5) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); if (_carFrame == 10) { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; } else if (_carFrame == 52) { resetDogVariables(); _animationMode = 0; @@ -1956,13 +1956,13 @@ void Scene608::step() { } } - if ((_carMode == 6) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 6) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); if (_carFrame == 11) { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; } else if (_carFrame == 41) { _globals._sequenceIndexes[10] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[10], false, 9, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 10, 11); @@ -2000,9 +2000,9 @@ void Scene608::step() { if (_game._trigger == 112) _dogYelping = false; - if ((_carMode == 0) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 0) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; if ((_globals[kCarStatus] == CAR_UP) || (_globals[kCarStatus] == CAR_DOWN)) { @@ -2015,7 +2015,7 @@ void Scene608::step() { break; case 1: - if (_scene->_activeAnimation->getCurrentFrame() >= 12) { + if (_scene->_animation[0]->getCurrentFrame() >= 12) { nextFrame = 0; _carMoveMode = 0; _globals[kCarStatus] = CAR_UP; @@ -2023,7 +2023,7 @@ void Scene608::step() { break; case 2: - if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + if (_scene->_animation[0]->getCurrentFrame() >= 6) { nextFrame = 6; _carMoveMode = 0; _globals[kCarStatus] = CAR_DOWN; @@ -2035,35 +2035,35 @@ void Scene608::step() { } } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _carFrame = nextFrame; } } } - if ((_carMode == 2) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 2) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; if (_carMoveMode == 0) nextFrame = 28; - else if (_scene->_activeAnimation->getCurrentFrame() >= 28) { + else if (_scene->_animation[0]->getCurrentFrame() >= 28) { nextFrame = 28; _carMoveMode = 0; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _carFrame = nextFrame; } } } - if ((_carMode == 3) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 3) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; if (_resetPositionsFl) { @@ -2071,22 +2071,22 @@ void Scene608::step() { _carMoveMode = 0; } else if (_carMoveMode == 0) nextFrame = 6; - else if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + else if (_scene->_animation[0]->getCurrentFrame() >= 6) { nextFrame = 6; _carMoveMode = 0; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _carFrame = nextFrame; } } } - if ((_carMode == 1) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { - _carFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_carMode == 1) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; if (_resetPositionsFl) { @@ -2094,13 +2094,13 @@ void Scene608::step() { _carMoveMode = 0; } else if (_carMoveMode == 0) nextFrame = 6; - else if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + else if (_scene->_animation[0]->getCurrentFrame() >= 6) { nextFrame = 6; _carMoveMode = 0; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _carFrame = nextFrame; } } @@ -2605,7 +2605,7 @@ void Scene609::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -4145,13 +4145,13 @@ void Scene611::step() { _hermitMovingFl = true; } - if (_stickFingerFl && (_scene->_activeAnimation->getCurrentFrame() == 47)) { + if (_stickFingerFl && (_scene->_animation[0]->getCurrentFrame() == 47)) { _stickFingerFl = false; _hermitMovingFl = true; _hermitMode = 1; } - if (_scene->_activeAnimation != nullptr && (_scene->_activeAnimation->getCurrentFrame() == 240) && _check1Fl) { + if (_scene->_animation[0] != nullptr && (_scene->_animation[0]->getCurrentFrame() == 240) && _check1Fl) { _check1Fl = false; _scene->_kernelMessages.add(Common::Point(33, 88), 0xFDFC, 0, 0, 90, _game.getQuote(0x27E)); _scene->_sequences.addTimer(120, 120); @@ -4240,7 +4240,7 @@ void Scene611::step() { } } - if (_scene->_activeAnimation != nullptr && _scene->_activeAnimation->getCurrentFrame() == 254) + if (_scene->_animation[0] != nullptr && _scene->_animation[0]->getCurrentFrame() == 254) _game._player._stepEnabled = true; if (_game._trigger == 110) { @@ -4266,7 +4266,7 @@ void Scene611::step() { } if (_hermitMode == 6) { - if ((_scene->_activeAnimation->getCurrentFrame() == 9) && _check1Fl) { + if ((_scene->_animation[0]->getCurrentFrame() == 9) && _check1Fl) { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.startPingPongCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); @@ -4275,7 +4275,7 @@ void Scene611::step() { _check1Fl = false; } - if ((_scene->_activeAnimation->getCurrentFrame() == 17) && !_check1Fl) { + if ((_scene->_animation[0]->getCurrentFrame() == 17) && !_check1Fl) { _nextFrame = 26; _hermitMode = 4; _check1Fl = true; @@ -4283,13 +4283,13 @@ void Scene611::step() { } if (_hermitMode == 4) { - if ((_scene->_activeAnimation->getCurrentFrame() == 33) && _check1Fl) { + if ((_scene->_animation[0]->getCurrentFrame() == 33) && _check1Fl) { displayHermitQuestions(_hermitDisplayedQuestion); _nextFrame = 1; _check1Fl = false; } - if ((_scene->_activeAnimation->getCurrentFrame() == 9) && !_check1Fl) { + if ((_scene->_animation[0]->getCurrentFrame() == 9) && !_check1Fl) { _nextFrame = 8; _scene->_sequences.addTimer(1, 113); _check1Fl = true; @@ -4315,8 +4315,8 @@ void Scene611::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 115); } - if ((_nextFrame >= 0) && (_nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(_nextFrame); + if ((_nextFrame >= 0) && (_nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(_nextFrame); _nextFrame = -1; } @@ -4588,7 +4588,7 @@ void Scene612::step() { switch (_game._trigger) { case 70: _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index c2a249e5f8..58280a73f4 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -361,7 +361,7 @@ void Scene701::actions() { case 1: { _game._player._visible = true; - _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._player._priorTimer = _scene->_animation[0]->getNextFrameTimer() - _game._player._ticksAmount; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth (_globals._sequenceIndexes[2], 9); int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); @@ -694,7 +694,7 @@ void Scene703::enter() { _boatDir = 2; _monsterMode = 0; _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(34); + _scene->_animation[0]->setCurrentFrame(34); } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) { _game._player._stepEnabled = false; _boatDir = 1; @@ -712,17 +712,17 @@ void Scene703::enter() { _boatDir = 1; _monsterMode = 1; _scene->loadAnimation(formAnimName('B', -1)); - _scene->_activeAnimation->setCurrentFrame(39); + _scene->_animation[0]->setCurrentFrame(39); } else if (_boatDir == 1) { _curSequence = 0; _monsterMode = 0; _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(9); + _scene->_animation[0]->setCurrentFrame(9); } else if (_boatDir == 2) { _curSequence = 0; _monsterMode = 0; _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(56); + _scene->_animation[0]->setCurrentFrame(56); } if (_scene->_roomChanged) { @@ -764,9 +764,9 @@ void Scene703::step() { if (_game._trigger == 70) _scene->_reloadSceneFlag = true; - if ((_monsterMode == 3) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { - _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_monsterMode == 3) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_animation[0]->getCurrentFrame(); int nextBoatFrame = -1; if (_boatFrame == 62) { @@ -777,8 +777,8 @@ void Scene703::step() { } } - if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextBoatFrame); _boatFrame = nextBoatFrame; } } @@ -787,9 +787,9 @@ void Scene703::step() { if (_game._trigger == 70) _scene->_reloadSceneFlag = true; - if ((_monsterMode == 0) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { - _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_monsterMode == 0) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_animation[0]->getCurrentFrame(); int nextBoatFrame = -1; switch (_boatFrame) { @@ -860,8 +860,8 @@ void Scene703::step() { break; } - if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextBoatFrame); _boatFrame = nextBoatFrame; } } @@ -895,9 +895,9 @@ void Scene703::step() { } - if ((_monsterMode == 1) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { - _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_monsterMode == 1) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_animation[0]->getCurrentFrame(); int nextBoatFrame = -1; switch (_boatFrame) { @@ -934,16 +934,16 @@ void Scene703::step() { break; } - if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextBoatFrame); _boatFrame = nextBoatFrame; } } } - if ((_monsterMode == 2) && (_scene->_activeAnimation != nullptr)) { - if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { - _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + if ((_monsterMode == 2) && (_scene->_animation[0] != nullptr)) { + if (_scene->_animation[0]->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_animation[0]->getCurrentFrame(); int nextBoatFrame = -1; switch (_boatFrame) { @@ -983,7 +983,7 @@ void Scene703::step() { _scene->freeAnimation(); _monsterMode = 1; _scene->loadAnimation(formAnimName('B', -1)); - _scene->_activeAnimation->setCurrentFrame(39); + _scene->_animation[0]->setCurrentFrame(39); _game._player._stepEnabled = true; break; @@ -992,7 +992,7 @@ void Scene703::step() { _scene->freeAnimation(); _monsterMode = 1; _scene->loadAnimation(formAnimName('B', -1)); - _scene->_activeAnimation->setCurrentFrame(39); + _scene->_animation[0]->setCurrentFrame(39); _game._player._stepEnabled = true; } else _game._objects.setRoom(OBJ_CHICKEN_BOMB, 1); @@ -1005,7 +1005,7 @@ void Scene703::step() { _scene->freeAnimation(); _monsterMode = 0; _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(9); + _scene->_animation[0]->setCurrentFrame(9); _game._player._stepEnabled = true; if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(70321); @@ -1018,8 +1018,8 @@ void Scene703::step() { break; } - if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextBoatFrame); _boatFrame = nextBoatFrame; } } @@ -1055,7 +1055,7 @@ void Scene703::actions() { _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - _scene->_activeAnimation->setCurrentFrame(19); + _scene->_animation[0]->setCurrentFrame(19); } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); @@ -1066,13 +1066,13 @@ void Scene703::actions() { _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - _scene->_activeAnimation->setCurrentFrame(39); + _scene->_animation[0]->setCurrentFrame(39); } else if (_action.isAction(VERB_THROW, NOUN_BOMB, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - _scene->_activeAnimation->setCurrentFrame(59); + _scene->_animation[0]->setCurrentFrame(59); } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, NOUN_SEA_MONSTER)) { _useBomb = true; _game._player._stepEnabled = false; @@ -1241,21 +1241,21 @@ void Scene704::enter() { _animationMode = 2; _boatDirection = 2; _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(36); + _scene->_animation[0]->setCurrentFrame(36); } else if (_scene->_priorSceneId != RETURNING_FROM_DIALOG) { _game._player._stepEnabled = false; _boatDirection = 1; _scene->loadAnimation(formAnimName('A', -1)); } else if (_boatDirection == 1) { _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(8); + _scene->_animation[0]->setCurrentFrame(8); } else if (_boatDirection == 2) { if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) { _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); } _scene->loadAnimation(formAnimName('A', -1)); - _scene->_activeAnimation->setCurrentFrame(57); + _scene->_animation[0]->setCurrentFrame(57); } if (_scene->_roomChanged) @@ -1269,9 +1269,9 @@ void Scene704::enter() { } void Scene704::step() { - if (_scene->_activeAnimation != nullptr) { - if (_scene->_activeAnimation->getCurrentFrame() != _boatCurrentFrame) { - _boatCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_scene->_animation[0] != nullptr) { + if (_scene->_animation[0]->getCurrentFrame() != _boatCurrentFrame) { + _boatCurrentFrame = _scene->_animation[0]->getCurrentFrame(); int nextFrame = -1; switch (_boatCurrentFrame) { @@ -1377,8 +1377,8 @@ void Scene704::step() { break; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); + if ((nextFrame >= 0) && (nextFrame != _scene->_animation[0]->getCurrentFrame())) { + _scene->_animation[0]->setCurrentFrame(nextFrame); _boatCurrentFrame = nextFrame; } } @@ -1906,9 +1906,9 @@ void Scene706::step() { _scene->_reloadSceneFlag = true; } - if (_scene->_activeAnimation != nullptr) { - if ((_animationMode != 0) && (_scene->_activeAnimation->getCurrentFrame() != _animationFrame)) { - _animationFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_scene->_animation[0] != nullptr) { + if ((_animationMode != 0) && (_scene->_animation[0]->getCurrentFrame() != _animationFrame)) { + _animationFrame = _scene->_animation[0]->getCurrentFrame(); if (_animationFrame == 6) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index a904569624..3c5cfe37a4 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -930,7 +930,7 @@ void Scene804::enter() { void Scene804::step() { if (!_messWithThrottle) { - if ((_throttleGone) && (_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 39)) { + if ((_throttleGone) && (_movingThrottle) && (_scene->_animation[0]->getCurrentFrame() == 39)) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle (_globals._spriteIndexes[1], false, 1); _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); @@ -938,7 +938,7 @@ void Scene804::step() { _throttleGone = false; } - if ((_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 42)) { + if ((_movingThrottle) && (_scene->_animation[0]->getCurrentFrame() == 42)) { _resetFrame = 0; _movingThrottle = false; } @@ -947,12 +947,12 @@ void Scene804::step() { _resetFrame = 42; } - if (_scene->_activeAnimation->getCurrentFrame() == 65) + if (_scene->_animation[0]->getCurrentFrame() == 65) _scene->_sequences.remove(_globals._sequenceIndexes[7]); switch (_game._storyMode) { case STORYMODE_NAUGHTY: - if (_scene->_activeAnimation->getCurrentFrame() == 81) { + if (_scene->_animation[0]->getCurrentFrame() == 81) { _resetFrame = 80; _globals[kInSpace] = false; _globals[kBeamIsUp] = true; @@ -964,7 +964,7 @@ void Scene804::step() { break; case STORYMODE_NICE: - if (_scene->_activeAnimation->getCurrentFrame() == 68) { + if (_scene->_animation[0]->getCurrentFrame() == 68) { _resetFrame = 66; _globals[kInSpace] = false; _globals[kBeamIsUp] = true; @@ -975,12 +975,12 @@ void Scene804::step() { } } - if (_scene->_activeAnimation->getCurrentFrame() == 34) { + if (_scene->_animation[0]->getCurrentFrame() == 34) { _resetFrame = 36; _scene->_sequences.remove(_globals._sequenceIndexes[1]); } - if (_scene->_activeAnimation->getCurrentFrame() == 37) { + if (_scene->_animation[0]->getCurrentFrame() == 37) { _resetFrame = 36; if (!_dontPullThrottleAgain) { _dontPullThrottleAgain = true; @@ -992,20 +992,20 @@ void Scene804::step() { _scene->_nextSceneId = 803; } - if ((_scene->_activeAnimation->getCurrentFrame() == 7) && (!_globals[kWindowFixed])) { + if ((_scene->_animation[0]->getCurrentFrame() == 7) && (!_globals[kWindowFixed])) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.addTimer(20, 110); _globals[kWindowFixed] = true; } - if (_scene->_activeAnimation->getCurrentFrame() == 10) { + if (_scene->_animation[0]->getCurrentFrame() == 10) { _resetFrame = 0; _game._player._stepEnabled = true; _game._objects.setRoom(OBJ_POLYCEMENT, NOWHERE); } // FIXME: Original doesn't have resetFrame check. Check why this has been needed - if (_resetFrame == -1 && _scene->_activeAnimation->getCurrentFrame() == 1) { + if (_resetFrame == -1 && _scene->_animation[0]->getCurrentFrame() == 1) { int randomVal = _vm->getRandomNumber(29) + 1; switch (randomVal) { case 1: @@ -1023,7 +1023,7 @@ void Scene804::step() { } } - switch (_scene->_activeAnimation->getCurrentFrame()) { + switch (_scene->_animation[0]->getCurrentFrame()) { case 26: case 28: case 31: @@ -1031,12 +1031,12 @@ void Scene804::step() { break; } } else { - if ((_scene->_activeAnimation->getCurrentFrame() == 36) && (!_throttleGone)) { + if ((_scene->_animation[0]->getCurrentFrame() == 36) && (!_throttleGone)) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _throttleGone = true; } - if (_scene->_activeAnimation->getCurrentFrame() == 39) { + if (_scene->_animation[0]->getCurrentFrame() == 39) { _movingThrottle = false; switch (_throttleCounter) { case 1: @@ -1074,8 +1074,8 @@ void Scene804::step() { } if (_resetFrame >= 0) { - if (_resetFrame != _scene->_activeAnimation->getCurrentFrame()) { - _scene->_activeAnimation->setCurrentFrame(_resetFrame); + if (_resetFrame != _scene->_animation[0]->getCurrentFrame()) { + _scene->_animation[0]->setCurrentFrame(_resetFrame); _resetFrame = -1; } } @@ -1084,12 +1084,12 @@ void Scene804::step() { _scene->_nextSceneId = 803; } - if ((_scene->_activeAnimation->getCurrentFrame() == 72) && !_alreadyPop) { + if ((_scene->_animation[0]->getCurrentFrame() == 72) && !_alreadyPop) { _vm->_sound->command(21); _alreadyPop = true; } - if ((_scene->_activeAnimation->getCurrentFrame() == 80) && !_alreadyOrgan) { + if ((_scene->_animation[0]->getCurrentFrame() == 80) && !_alreadyOrgan) { _vm->_sound->command(22); _alreadyOrgan = true; } @@ -1606,7 +1606,7 @@ void Scene810::enter() { } void Scene810::step() { - if (_scene->_activeAnimation && (_scene->_activeAnimation->getCurrentFrame() == 200) + if (_scene->_animation[0] && (_scene->_animation[0]->getCurrentFrame() == 200) && _moveAllowed) { _scene->_sequences.addTimer(100, 70); _moveAllowed = false; -- cgit v1.2.3 From b06b0ef8722c40e193157d4594dcd4a61fde9b44 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 Oct 2015 23:33:23 +0100 Subject: MADS: Janitorial: Remove trailing spaces and tabs --- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/nebular/nebular_scenes3.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index e8e0a4f42c..578af51f54 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -350,7 +350,7 @@ void GameNebular::setSectionHandler() { void GameNebular::checkShowDialog() { // Loop for showing dialogs, if any need to be shown - if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus) + if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus) && !_globals[kCopyProtectFailed]) { _player.releasePlayerSprites(); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 717dd85de7..40560357cc 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2655,7 +2655,7 @@ void Scene318::enter() { 0x1C8, 0x1C9, 0x1CA, 0x1CB, 0x1CC, 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x190, 0x19D, 0); - if ((_scene->_priorSceneId == RETURNING_FROM_DIALOG) || (((_scene->_priorSceneId == 318) || + if ((_scene->_priorSceneId == RETURNING_FROM_DIALOG) || (((_scene->_priorSceneId == 318) || (_scene->_priorSceneId == RETURNING_FROM_LOADING)) && (!_globals[kAfterHavoc]))) { if (!_globals[kAfterHavoc]) { _game._player._visible = false; diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 092ddeb3f7..76eccf9714 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -2089,7 +2089,7 @@ void Scene511::actions() { } else { _vm->_dialogs->show(51130); } - } else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) || + } else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_BOAT)) { if (_globals[kBoatRaised]) _vm->_dialogs->show(51131); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 5b7dae4489..4fa1f77d06 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -3930,7 +3930,7 @@ void Scene611::enter() { 0x2D9, 0x2DA, 0x2DB, 0x2DC, 0x2DD, 0x2DE, 0x2DF, 0x2E0, 0x2E1, 0x2E2, 0x2E3, 0x2E4, 0x2E5, 0x2E6, 0x323, 0x324, 0); - _dialog1.setup(kConvHermit1, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, + _dialog1.setup(kConvHermit1, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0); _dialog2.setup(kConvHermit2, 0x29C, 0x29D, 0x29E, 0x29F, 0); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 3c5cfe37a4..951b270a1c 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -1606,7 +1606,7 @@ void Scene810::enter() { } void Scene810::step() { - if (_scene->_animation[0] && (_scene->_animation[0]->getCurrentFrame() == 200) + if (_scene->_animation[0] && (_scene->_animation[0]->getCurrentFrame() == 200) && _moveAllowed) { _scene->_sequences.addTimer(100, 70); _moveAllowed = false; -- cgit v1.2.3 From 34d5f929ac2c3b3e61a5bb48968a07c62e25f3ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 9 Nov 2015 21:40:18 +0100 Subject: MADS: Remove useless casts in per-game logic --- engines/mads/nebular/game_nebular.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 578af51f54..1976bcb928 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -824,7 +824,7 @@ void GameNebular::unhandledAction() { void GameNebular::step() { if (_player._visible && _player._stepEnabled && !_player._moving && (_player._facing == _player._turnToFacing)) { - if (_scene._frameStartTime >= *((uint32 *)&_globals[kWalkerTiming])) { + if (_scene._frameStartTime >= (uint32)_globals[kWalkerTiming]) { if (!_player._stopWalkerIndex) { int randomVal = _vm->getRandomNumber(29999); if (_globals[kSexOfRex] == REX_MALE) { @@ -873,19 +873,19 @@ void GameNebular::step() { } } - *((uint32 *)&_globals[kWalkerTiming]) += 6; + _globals[kWalkerTiming] += 6; } } // Below is countdown to set the timebomb off in room 604 if (_globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) { - int diff = _scene._frameStartTime - *((uint32 *)&_globals[kTimebombClock]); - if ((diff >= 0) && (diff <= 60)) { - *((uint32 *)&_globals[kTimebombTimer]) += diff; - } else { - ++*((uint32 *)&_globals[kTimebombTimer]); - } - *((uint32 *)&_globals[kTimebombClock]) = _scene._frameStartTime; + int diff = _scene._frameStartTime - _globals[kTimebombClock]; + if ((diff >= 0) && (diff <= 60)) + _globals[kTimebombTimer] += diff; + else + ++_globals[kTimebombTimer]; + + _globals[kTimebombClock] = (int) _scene._frameStartTime; } } -- cgit v1.2.3 From a475a7f18a221d5e9f31ec380bfe2a828b8537e2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 13 Nov 2015 11:36:04 +0100 Subject: MADS: Rex: Use a constant when checking _mainObjectSource --- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- engines/mads/nebular/nebular_scenes3.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 4 ++-- engines/mads/nebular/nebular_scenes6.cpp | 6 +++--- engines/mads/nebular/nebular_scenes7.cpp | 10 +++++----- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/mads/nebular') diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d5e1fc08f7..c33ce7f780 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1263,7 +1263,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, NOUN_BURGER) && (_action._mainObjectSource == 4)) { + if (_action.isAction(VERB_LOOK, NOUN_BURGER) && (_action._mainObjectSource == CAT_HOTSPOT)) { _vm->_dialogs->show(801); _action._inProgress = false; } @@ -2295,7 +2295,7 @@ void Scene107::actions() { _scene->_nextSceneId = 105; else if (_action.isAction(VERB_LOOK, NOUN_NORTHERN_SEA_CLIFF)) _vm->_dialogs->show(10701); - else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(10702); else if (_action.isAction(VERB_LOOK, NOUN_BUSH_LIKE_FORMATION)) _vm->_dialogs->show(10703); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index ad15f83707..7349677ab8 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1405,9 +1405,9 @@ void Scene205::actions() { _vm->_dialogs->show(20503); else if (_action.isAction(VERB_LOOK, NOUN_HUT)) _vm->_dialogs->show(20504); - else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(20505); - else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(20506); else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN_ON_SPIT)) _vm->_dialogs->show(20507); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 40560357cc..f9513b9bd3 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5045,7 +5045,7 @@ void Scene359::actions() { _vm->_dialogs->show(35918); else if (_action.isAction(VERB_TAKE, NOUN_LIMB)) _vm->_dialogs->show(35919); - else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_CARD) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_CARD) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(35921); else if (_action.isAction(VERB_LOOK, NOUN_BLOOD_STAIN)) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 76eccf9714..3778a59eb3 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -2159,9 +2159,9 @@ void Scene511::actions() { _vm->_dialogs->show(51128); } else if (_action.isAction(VERB_LOOK, NOUN_PORTHOLE)) _vm->_dialogs->show(51122); - else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 2)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == CAT_HOTSPOT) && (_globals[kLineStatus] == 2)) _vm->_dialogs->show(51126); - else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 3)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == CAT_HOTSPOT) && (_globals[kLineStatus] == 3)) _vm->_dialogs->show(51133); else if (_action.isAction(VERB_LOOK, NOUN_STATUE)) _vm->_dialogs->show(51127); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 4fa1f77d06..7098566f80 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -684,7 +684,7 @@ void Scene603::actions() { _vm->_dialogs->show(60327); else _vm->_dialogs->show(60328); - } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == 4)) + } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(60329); // For the next two checks, the second part of the check wasn't surrounded par parenthesis, which was obviously wrong else if (_action.isAction(VERB_LOOK) && (_action.isObject(NOUN_BRA) || _action.isObject(NOUN_BOA) || _action.isObject(NOUN_SLIP))) @@ -2476,7 +2476,7 @@ void Scene608::actions() { _vm->_dialogs->show(60824); } else if (_action.isAction(VERB_OPEN, NOUN_STORAGE_BOX)) _vm->_dialogs->show(60826); - else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(60828); else if (_action.isAction(VERB_LOOK, NOUN_TOOL_BOX)) { if (_game._objects[OBJ_POLYCEMENT]._roomNumber == _scene->_currentSceneId) @@ -3014,7 +3014,7 @@ void Scene610::actions() { _vm->_dialogs->show(61024); else if (_action.isAction(VERB_LOOK, NOUN_SPOTLIGHT)) _vm->_dialogs->show(61025); - else if (_action.isAction(VERB_LOOK, NOUN_PHONE_HANDSET) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_PHONE_HANDSET) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(61026); else if (_action.isAction(VERB_LOOK, NOUN_PHONE_CRADLE)) _vm->_dialogs->show(61027); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 58280a73f4..6caebb7f79 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -498,7 +498,7 @@ void Scene702::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 711; - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -537,9 +537,9 @@ void Scene702::actions() { _vm->_dialogs->show(70215); else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(70216); - else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(70217); - else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4)) { + else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == CAT_HOTSPOT)) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(70219); } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) @@ -1455,7 +1455,7 @@ void Scene704::actions() { _vm->_dialogs->show(70412); } else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM)) _vm->_dialogs->show(70413); - else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(70414); else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH)) _vm->_dialogs->show(70416); @@ -2017,7 +2017,7 @@ void Scene706::actions() { _vm->_dialogs->show(70623); else if (_action.isAction(VERB_LOOK, NOUN_VASE) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)) _vm->_dialogs->show(70624); - else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == CAT_HOTSPOT)) _vm->_dialogs->show(70632); else return; -- cgit v1.2.3