aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus/neighborhood/norad/alpha
diff options
context:
space:
mode:
authorclone27272012-09-20 13:17:39 -0700
committerclone27272012-09-20 13:17:39 -0700
commit2e4ee0b2d0f687deb16ca18691042de1a21d7410 (patch)
tree18af0d530c316695536bcc79847c8c7af35aa50b /engines/pegasus/neighborhood/norad/alpha
parent2a3ba6ac4ff8d4c03efb94fad8eaa36c9515c6f7 (diff)
parent167768669283620a2a951dcf212890a37cf1d6b8 (diff)
downloadscummvm-rg350-2e4ee0b2d0f687deb16ca18691042de1a21d7410.tar.gz
scummvm-rg350-2e4ee0b2d0f687deb16ca18691042de1a21d7410.tar.bz2
scummvm-rg350-2e4ee0b2d0f687deb16ca18691042de1a21d7410.zip
Merge pull request #275 from clone2727/pegasus
Pegasus engine (The Journeyman Project: Pegasus Prime)
Diffstat (limited to 'engines/pegasus/neighborhood/norad/alpha')
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp219
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h65
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp445
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/fillingstation.h91
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp763
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/noradalpha.h115
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panorama.cpp239
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panorama.h98
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp91
-rw-r--r--engines/pegasus/neighborhood/norad/alpha/panoramascroll.h60
10 files changed, 2186 insertions, 0 deletions
diff --git a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
new file mode 100644
index 0000000000..ff1f078b15
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.cpp
@@ -0,0 +1,219 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pegasus/pegasus.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/norad.h"
+#include "pegasus/neighborhood/norad/alpha/ecrmonitor.h"
+
+namespace Pegasus {
+
+static const NotificationFlags kECRSection1FinishedFlag = 1;
+static const NotificationFlags kECRPanFinishedFlag = kECRSection1FinishedFlag << 1;
+static const NotificationFlags kECRSection2FinishedFlag = kECRPanFinishedFlag << 1;
+static const NotificationFlags kECRNotificationFlags = kECRSection1FinishedFlag |
+ kECRPanFinishedFlag |
+ kECRSection2FinishedFlag;
+
+static const TimeValue kSection1Start = 0;
+static const TimeValue kSection1Stop = 25;
+static const TimeValue kPanStart = 0;
+static const TimeValue kPanStop = 20;
+static const TimeValue kSection2Start = 26;
+static const TimeValue kSection2Stop = 1000;
+
+// Seems to be a good value for a 20 second pan.
+static const CoordType kPanPixelsPerFrame = 8;
+
+// Interesting times are in seconds.
+static const TimeValue s_ECRInterestingTimes[] = {
+ 0, 1, 2, 10, 25, 26, 56, 64, 72, 80, 88, 94, 102, 108, 116, 999
+};
+
+// Index into s_ECRInterestingTimes of interesting time before security pan.
+static const int kBeforePanTime = 3;
+
+// Index into s_ECRInterestingTimes of interesting time after security pan.
+static const int kAfterPanTime = 5;
+
+NoradAlphaECRMonitor::NoradAlphaECRMonitor(Neighborhood *nextHandler) : GameInteraction(kNoradECRMonitorInteractionID, nextHandler),
+ _ecrSlideShowNotification(kNoradECRNotificationID, (PegasusEngine *)g_engine), _ecrMovie(kECRSlideShowMovieID),
+ _ecrPan(kECRPanID) {
+}
+
+void NoradAlphaECRMonitor::receiveNotification(Notification *, const NotificationFlags flags) {
+ if (flags & kECRSection1FinishedFlag)
+ ecrSection1Finished();
+ else if (flags & kECRPanFinishedFlag)
+ ecrPanFinished();
+ else if (flags & kECRSection2FinishedFlag)
+ ecrSection2Finished();
+}
+
+int NoradAlphaECRMonitor::findCurrentInterestingTime() {
+ TimeValue time = _ecrMovie.getTime();
+ TimeScale scale = _ecrMovie.getScale();
+
+ for (int i = ARRAYSIZE(s_ECRInterestingTimes) - 1; i >= 0; i--)
+ if (time >= s_ECRInterestingTimes[i] * scale)
+ return i;
+
+ return 0;
+}
+
+void NoradAlphaECRMonitor::skipToNextInterestingTime() {
+ if (_ecrMovie.isRunning()) {
+ int interestingTime = findCurrentInterestingTime();
+ _ecrMovie.setTime(s_ECRInterestingTimes[interestingTime + 1] * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ } else if (_ecrPan.isRunning()) {
+ _ecrPanCallBack.cancelCallBack();
+ ecrPanFinished();
+ }
+}
+
+void NoradAlphaECRMonitor::skipToPreviousInterestingTime() {
+ if (_ecrPan.isRunning()) {
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrPanCallBack.cancelCallBack();
+
+ _ecrMovieCallBack.setCallBackFlag(kECRSection1FinishedFlag);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+ _ecrMovie.setTime(s_ECRInterestingTimes[kBeforePanTime] * scale);
+ _ecrMovie.start();
+ } else {
+ int interestingTime = findCurrentInterestingTime();
+
+ if (interestingTime == kAfterPanTime) {
+ _ecrMovieCallBack.cancelCallBack();
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+ _ecrMovie.setTime(kSection1Stop * scale);
+ ecrSection1Finished();
+ } else if (interestingTime == 0) {
+ _ecrMovie.setTime(kSection1Start * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ } else {
+ _ecrMovie.setTime(s_ECRInterestingTimes[interestingTime - 1] * _ecrMovie.getScale());
+ _ecrMovie.redrawMovieWorld();
+ }
+ }
+}
+
+void NoradAlphaECRMonitor::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ if (isInteracting()) {
+ if (input.rightButtonDown())
+ skipToNextInterestingTime();
+ else if (input.leftButtonDown())
+ skipToPreviousInterestingTime();
+ else
+ InputHandler::handleInput(input, cursorSpot);
+ } else {
+ InputHandler::handleInput(input, cursorSpot);
+ }
+}
+
+void NoradAlphaECRMonitor::ecrSection1Finished() {
+ _ecrMovie.stop();
+ _ecrPanCallBack.setNotification(&_ecrSlideShowNotification);
+ _ecrPanCallBack.initCallBack(&_ecrPan, kCallBackAtExtremes);
+ _ecrPanCallBack.setCallBackFlag(kECRPanFinishedFlag);
+ _ecrSlideShowNotification.notifyMe(this, kECRNotificationFlags, kECRNotificationFlags);
+ _ecrPanCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _ecrPan.startDisplaying();
+ _ecrPan.show();
+
+ TimeScale scale = _ecrPan.getScale();
+ _ecrPan.setSegment(kPanStart * scale, kPanStop * scale);
+ _ecrPan.setTime(0);
+ _ecrPan.start();
+}
+
+void NoradAlphaECRMonitor::ecrPanFinished() {
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrMovieCallBack.setCallBackFlag(kECRSection2FinishedFlag);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection2Start * scale, kSection2Stop * scale);
+ _ecrMovie.start();
+}
+
+void NoradAlphaECRMonitor::ecrSection2Finished() {
+ _ecrMovie.stop();
+ _ecrMovie.stopDisplaying();
+}
+
+void NoradAlphaECRMonitor::openInteraction() {
+ // Initialize the security pan.
+ _ecrPan.initFromMovieFile("Images/Norad Alpha/Security Pan.pano");
+ _ecrPan.initMaskFromPICTFile("Images/Norad Alpha/Security Pan Mask");
+ _ecrPan.setBounds(Common::Rect(kECRPanLeft, kECRPanTop, kECRPanRight, kECRPanBottom));
+ _ecrPan.setDisplayOrder(kECRPanOrder);
+ _ecrPan.setScale(15); // 15 fps.
+
+ // Begin the lame ECR slide show.
+ // clone2727: I didn't say it :P
+ _ecrMovie.initFromMovieFile("Images/Norad Alpha/ECR Monitor Movie");
+
+ _ecrMovieCallBack.setNotification(&_ecrSlideShowNotification);
+ _ecrMovieCallBack.initCallBack(&_ecrMovie, kCallBackAtExtremes);
+ _ecrMovieCallBack.setCallBackFlag(kECRSection1FinishedFlag);
+
+ _ecrSlideShowNotification.notifyMe(this, kECRNotificationFlags, kECRNotificationFlags);
+ _ecrMovieCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+
+ _ecrMovie.moveElementTo(kECRSlideShowLeft, kECRSlideShowTop);
+ _ecrMovie.setDisplayOrder(kECRMonitorOrder);
+ _ecrMovie.startDisplaying();
+ _ecrMovie.show();
+ _ecrMovie.redrawMovieWorld();
+
+ TimeScale scale = _ecrMovie.getScale();
+ _ecrMovie.setSegment(kSection1Start * scale, kSection1Stop * scale + 1);
+
+ _ecrMovie.start();
+}
+
+void NoradAlphaECRMonitor::closeInteraction() {
+ _ecrMovieCallBack.releaseCallBack();
+ _ecrMovie.stop();
+ _ecrMovie.stopDisplaying();
+ _ecrMovie.releaseMovie();
+ _ecrMovieCallBack.releaseCallBack();
+
+ _ecrPanCallBack.releaseCallBack();
+ _ecrPan.stop();
+ _ecrPan.stopDisplaying();
+ _ecrPan.releasePanorama();
+ _ecrPanCallBack.releaseCallBack();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h
new file mode 100644
index 0000000000..9e286ed337
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/ecrmonitor.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_ecrMONITOR_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_ecrMONITOR_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/notification.h"
+#include "pegasus/neighborhood/norad/alpha/panoramascroll.h"
+
+namespace Pegasus {
+
+class NoradAlphaECRMonitor : public GameInteraction, public NotificationReceiver {
+public:
+ NoradAlphaECRMonitor(Neighborhood *);
+ virtual ~NoradAlphaECRMonitor() {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+
+protected:
+ virtual void openInteraction();
+ virtual void closeInteraction();
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ void ecrSection1Finished();
+ void ecrPanFinished();
+ void ecrSection2Finished();
+
+ int findCurrentInterestingTime();
+ void skipToNextInterestingTime();
+ void skipToPreviousInterestingTime();
+
+ Notification _ecrSlideShowNotification;
+ Movie _ecrMovie;
+ NotificationCallBack _ecrMovieCallBack;
+ PanoramaScroll _ecrPan;
+ NotificationCallBack _ecrPanCallBack;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
new file mode 100644
index 0000000000..53f12ba55f
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.cpp
@@ -0,0 +1,445 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/alpha/fillingstation.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+
+namespace Pegasus {
+
+static const NotificationFlags kFSPowerUpFinishedFlag = 1;
+static const NotificationFlags kFSSplashFinishedFlag = kFSPowerUpFinishedFlag << 1;
+static const NotificationFlags kFSIntakeWarningFinishedFlag = kFSSplashFinishedFlag << 1;
+static const NotificationFlags kFSIntakeHiliteFinishedFlag = kFSIntakeWarningFinishedFlag << 1;
+static const NotificationFlags kFSDispenseHiliteFinishedFlag = kFSIntakeHiliteFinishedFlag << 1;
+static const NotificationFlags kFSArHiliteFinishedFlag = kFSDispenseHiliteFinishedFlag << 1;
+static const NotificationFlags kFSCO2HiliteFinishedFlag = kFSArHiliteFinishedFlag << 1;
+static const NotificationFlags kFSHeHiliteFinishedFlag = kFSCO2HiliteFinishedFlag << 1;
+static const NotificationFlags kFSOHiliteFinishedFlag = kFSHeHiliteFinishedFlag << 1;
+static const NotificationFlags kFSNHiliteFinishedFlag = kFSOHiliteFinishedFlag << 1;
+
+static const NotificationFlags kFSNotificationFlags = kFSPowerUpFinishedFlag |
+ kFSSplashFinishedFlag |
+ kFSIntakeWarningFinishedFlag |
+ kFSIntakeHiliteFinishedFlag |
+ kFSDispenseHiliteFinishedFlag |
+ kFSArHiliteFinishedFlag |
+ kFSCO2HiliteFinishedFlag |
+ kFSHeHiliteFinishedFlag |
+ kFSOHiliteFinishedFlag |
+ kFSNHiliteFinishedFlag;
+
+static const int16 kNoState = 0;
+static const int16 kMainMenu = 1;
+static const int16 kWaitingForAttach = 2;
+static const int16 kDispenseMenu = 3;
+static const int16 kWaitingForDispense = 4;
+
+// Dummy itemIDs
+static const ItemID kCO2Item = 10000;
+static const ItemID kHeItem = 10001;
+
+// Interactive points.
+static const TimeValue kFSPowerUpStartStart = 0;
+static const TimeValue kFSPowerUpStartStop = 600;
+static const TimeValue kFSSplashStart = 600;
+static const TimeValue kFSSplashStop = 7800;
+static const TimeValue kFSSplashIntakeStart = 7800;
+static const TimeValue kFSSplashIntakeStop = 18600;
+
+static const TimeValue kFSMainMenu = 18600;
+static const TimeValue kFSIntakeHiliteStart = 19200;
+static const TimeValue kFSIntakeHiliteStop = 19800;
+static const TimeValue kFSDispenseHiliteStart = 19800;
+static const TimeValue kFSDispenseHiliteStop = 20400;
+
+static const TimeValue kFSDispenseMenu = 20400;
+
+static const TimeValue kFSArHiliteStart = 21000;
+static const TimeValue kFSArHiliteStop = 21600;
+static const TimeValue kFSArAttach = 21600;
+static const TimeValue kFSArFilledStart = 22200;
+static const TimeValue kFSArFilledStop = 25200;
+static const TimeValue kFSArIncompatibleStart = 25200;
+static const TimeValue kFSArIncompatibleStop = 30000;
+
+static const TimeValue kFSCO2HiliteStart = 30000;
+static const TimeValue kFSCO2HiliteStop = 30600;
+static const TimeValue kFSCO2Attach = 30600;
+static const TimeValue kFSCO2FilledStart = 31200;
+static const TimeValue kFSCO2FilledStop = 34200;
+static const TimeValue kFSCO2IncompatibleStart = 34200;
+static const TimeValue kFSCO2IncompatibleStop = 39000;
+
+static const TimeValue kFSHeHiliteStart = 39000;
+static const TimeValue kFSHeHiliteStop = 39600;
+static const TimeValue kFSHeAttach = 39600;
+static const TimeValue kFSHeFilledStart = 40200;
+static const TimeValue kFSHeFilledStop = 43200;
+static const TimeValue kFSHeIncompatibleStart = 43200;
+static const TimeValue kFSHeIncompatibleStop = 48000;
+
+static const TimeValue kFSOHiliteStart = 48000;
+static const TimeValue kFSOHiliteStop = 48600;
+static const TimeValue kFSOAttach = 48600;
+static const TimeValue kFSOFilledStart = 49200;
+static const TimeValue kFSOFilledStop = 52200;
+static const TimeValue kFSOIncompatibleStart = 52200;
+static const TimeValue kFSOIncompatibleStop = 57000;
+
+static const TimeValue kFSNHiliteStart = 57000;
+static const TimeValue kFSNHiliteStop = 57600;
+static const TimeValue kFSNAttach = 57600;
+static const TimeValue kFSNFilledStart = 58200;
+static const TimeValue kFSNFilledStop = 61200;
+static const TimeValue kFSNIncompatibleStart = 61200;
+static const TimeValue kFSNIncompatibleStop = 66000;
+
+static const TimeValue kFSIntakeMenu = 66000;
+static const TimeValue kFSIntakeInProgressStart = 66600;
+static const TimeValue kFSIntakeInProgressStop = 69600;
+
+NoradAlphaFillingStation::NoradAlphaFillingStation(Neighborhood *owner) : GameInteraction(kNoradFillingStationInteractionID, owner),
+ _rightSideMovie(kN01RightSideID), _rightSideNotification(kNoradFillingStationNotificationID, ((PegasusEngine *)g_engine)) {
+ _state = kNoState;
+}
+
+void NoradAlphaFillingStation::openInteraction() {
+ _rightSideMovie.initFromMovieFile("Images/Norad Alpha/N01W Right Side");
+ _rightSideMovie.moveElementTo(kNoradAlpha01RightSideLeft, kNoradAlpha01RightSideTop);
+ _rightSideMovie.setDisplayOrder(kN01RightSideOrder);
+ _rightSideMovie.startDisplaying();
+ _rightSideCallBack.setNotification(&_rightSideNotification);
+ _rightSideCallBack.initCallBack(&_rightSideMovie, kCallBackAtExtremes);
+ _rightSideCallBack.setCallBackFlag(kFSPowerUpFinishedFlag);
+ _rightSideNotification.notifyMe(this, kFSNotificationFlags, kFSNotificationFlags);
+ _rightSideCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _rightSideMovie.show();
+ _rightSideMovie.redrawMovieWorld();
+ _rightSideMovie.setSegment(kFSPowerUpStartStart, kFSPowerUpStartStop);
+}
+
+void NoradAlphaFillingStation::initInteraction() {
+ allowInput(false);
+
+ _rightSideMovie.setRate(2);
+}
+
+void NoradAlphaFillingStation::closeInteraction() {
+ _rightSideMovie.stop();
+ _rightSideMovie.stopDisplaying();
+ _rightSideMovie.releaseMovie();
+ _rightSideCallBack.releaseCallBack();
+ ((NoradAlpha *)getOwner())->turnOffFillingStation();
+}
+
+void NoradAlphaFillingStation::setStaticState(TimeValue time, int16 state) {
+ _rightSideMovie.stop();
+ _rightSideMovie.setSegment(0, _rightSideMovie.getDuration());
+ _rightSideMovie.setTime(time);
+ _rightSideMovie.redrawMovieWorld();
+ _state = state;
+ allowInput(true);
+}
+
+void NoradAlphaFillingStation::setSegmentState(TimeValue start, TimeValue stop, NotificationFlags flag, int16 state) {
+ _rightSideMovie.stop();
+ _rightSideMovie.setSegment(start, stop);
+ _rightSideMovie.setTime(start);
+ _rightSideCallBack.setCallBackFlag(flag);
+ _rightSideCallBack.scheduleCallBack(kTriggerAtStop, 0, 0);
+ _state = state;
+ allowInput(false);
+ _rightSideMovie.setRate(2);
+}
+
+void NoradAlphaFillingStation::powerUpFinished() {
+ ((NoradAlpha *)getOwner())->turnOnFillingStation();
+ setSegmentState(kFSSplashStart, kFSSplashStop, kFSSplashFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::splashFinished() {
+ if (GameState.getNoradGassed())
+ setSegmentState(kFSSplashIntakeStart, kFSSplashIntakeStop, kFSIntakeWarningFinishedFlag, kNoState);
+ else
+ intakeWarningFinished();
+}
+
+void NoradAlphaFillingStation::intakeWarningFinished() {
+ setStaticState(kFSMainMenu, kMainMenu);
+}
+
+void NoradAlphaFillingStation::showIntakeInProgress(uint16 numSeconds) {
+ if (numSeconds == 0) {
+ setSegmentState(kFSIntakeInProgressStart, kFSIntakeInProgressStop, kFSIntakeWarningFinishedFlag, kNoState);
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+
+ if (item->getObjectID() == kGasCanister) {
+ GameState.setNoradGassed(true);
+ ((NoradAlpha *)getOwner())->loadAmbientLoops();
+ getOwner()->restoreStriding(kNorad03, kEast, kAltNoradAlphaNormal);
+ }
+ } else {
+ setSegmentState(kFSIntakeInProgressStart, kFSIntakeInProgressStart + _rightSideMovie.getScale() * numSeconds,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ }
+}
+
+void NoradAlphaFillingStation::intakeHighlightFinished() {
+ _rightSideMovie.stop();
+
+ if (GameState.getNoradGassed()) {
+ showIntakeInProgress(2);
+ } else {
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+ if (item)
+ showIntakeInProgress(0);
+ else
+ setStaticState(kFSIntakeMenu, kWaitingForAttach);
+ }
+}
+
+void NoradAlphaFillingStation::dispenseHighlightFinished() {
+ setStaticState(kFSDispenseMenu, kDispenseMenu);
+}
+
+void NoradAlphaFillingStation::dispenseGas() {
+ Item *item = ((NoradAlpha *)getOwner())->getFillingItem();
+
+ if (item) {
+ if (item->getObjectID() != _dispenseItemID)
+ switch (_dispenseItemID) {
+ case kArgonCanister:
+ setSegmentState(kFSArIncompatibleStart, kFSArIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kCO2Item:
+ setSegmentState(kFSCO2IncompatibleStart, kFSCO2IncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kHeItem:
+ setSegmentState(kFSHeIncompatibleStart, kFSHeIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kAirMask:
+ setSegmentState(kFSOIncompatibleStart, kFSOIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ case kNitrogenCanister:
+ setSegmentState(kFSNIncompatibleStart, kFSNIncompatibleStop,
+ kFSIntakeWarningFinishedFlag, kNoState);
+ break;
+ }
+ else {
+ if (_dispenseItemID == kArgonCanister) {
+ setSegmentState(kFSArFilledStart, kFSArFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ item->setItemState(kArgonFull);
+ GameState.setScoringFilledArgonCanister(true);
+ } else if (_dispenseItemID == kAirMask) {
+ setSegmentState(kFSOFilledStart, kFSOFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ ((AirMask *)item)->refillAirMask();
+ GameState.setScoringFilledOxygenCanister(true);
+ } else if (_dispenseItemID == kNitrogenCanister) {
+ setSegmentState(kFSNFilledStart, kFSNFilledStop, kFSIntakeWarningFinishedFlag, kNoState);
+ item->setItemState(kNitrogenFull);
+ }
+ }
+ } else {
+ switch (_dispenseItemID) {
+ case kArgonCanister:
+ setStaticState(kFSArAttach, kWaitingForDispense);
+ break;
+ case kCO2Item:
+ setStaticState(kFSCO2Attach, kWaitingForDispense);
+ break;
+ case kHeItem:
+ setStaticState(kFSHeAttach, kWaitingForDispense);
+ break;
+ case kAirMask:
+ setStaticState(kFSOAttach, kWaitingForDispense);
+ break;
+ case kNitrogenCanister:
+ setStaticState(kFSNAttach, kWaitingForDispense);
+ break;
+ }
+ }
+}
+
+void NoradAlphaFillingStation::ArHighlightFinished() {
+ _dispenseItemID = kArgonCanister;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::CO2HighlightFinished() {
+ _dispenseItemID = kCO2Item;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::HeHighlightFinished() {
+ _dispenseItemID = kHeItem;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::OHighlightFinished() {
+ _dispenseItemID = kAirMask;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::NHighlightFinished() {
+ _dispenseItemID = kNitrogenCanister;
+ dispenseGas();
+}
+
+void NoradAlphaFillingStation::receiveNotification(Notification *, const NotificationFlags flags) {
+ switch (flags) {
+ case kFSPowerUpFinishedFlag:
+ powerUpFinished();
+ break;
+ case kFSSplashFinishedFlag:
+ splashFinished();
+ break;
+ case kFSIntakeWarningFinishedFlag:
+ intakeWarningFinished();
+ break;
+ case kFSIntakeHiliteFinishedFlag:
+ intakeHighlightFinished();
+ break;
+ case kFSDispenseHiliteFinishedFlag:
+ dispenseHighlightFinished();
+ break;
+ case kFSArHiliteFinishedFlag:
+ ArHighlightFinished();
+ break;
+ case kFSCO2HiliteFinishedFlag:
+ CO2HighlightFinished();
+ break;
+ case kFSHeHiliteFinishedFlag:
+ HeHighlightFinished();
+ break;
+ case kFSOHiliteFinishedFlag:
+ OHighlightFinished();
+ break;
+ case kFSNHiliteFinishedFlag:
+ NHighlightFinished();
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::handleInput(const Input &input, const Hotspot *cursorSpot) {
+ InputHandler::handleInput(input, cursorSpot);
+}
+
+void NoradAlphaFillingStation::clickInIntake() {
+ setSegmentState(kFSIntakeHiliteStart, kFSIntakeHiliteStop, kFSIntakeHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInDispense() {
+ setSegmentState(kFSDispenseHiliteStart, kFSDispenseHiliteStop, kFSDispenseHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInAr() {
+ setSegmentState(kFSArHiliteStart, kFSArHiliteStop, kFSArHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInCO2() {
+ setSegmentState(kFSCO2HiliteStart, kFSCO2HiliteStop, kFSCO2HiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInHe() {
+ setSegmentState(kFSHeHiliteStart, kFSHeHiliteStop, kFSHeHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInO() {
+ setSegmentState(kFSOHiliteStart, kFSOHiliteStop, kFSOHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInN() {
+ setSegmentState(kFSNHiliteStart, kFSNHiliteStop, kFSNHiliteFinishedFlag, kNoState);
+}
+
+void NoradAlphaFillingStation::clickInHotspot(const Input &input, const Hotspot *spot) {
+ GameInteraction::clickInHotspot(input, spot);
+
+ switch (spot->getObjectID()) {
+ case kNorad01IntakeSpotID:
+ clickInIntake();
+ break;
+ case kNorad01DispenseSpotID:
+ clickInDispense();
+ break;
+ case kNorad01ArSpotID:
+ clickInAr();
+ break;
+ case kNorad01CO2SpotID:
+ clickInCO2();
+ break;
+ case kNorad01HeSpotID:
+ clickInHe();
+ break;
+ case kNorad01OSpotID:
+ clickInO();
+ break;
+ case kNorad01NSpotID:
+ clickInN();
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::activateHotspots() {
+ GameInteraction::activateHotspots();
+
+ switch (_state) {
+ case kMainMenu:
+ g_allHotspots.activateOneHotspot(kNorad01IntakeSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01DispenseSpotID);
+ break;
+ case kDispenseMenu:
+ g_allHotspots.activateOneHotspot(kNorad01ArSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01CO2SpotID);
+ g_allHotspots.activateOneHotspot(kNorad01HeSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01OSpotID);
+ g_allHotspots.activateOneHotspot(kNorad01NSpotID);
+ break;
+ }
+}
+
+void NoradAlphaFillingStation::newFillingItem(Item *item) {
+ switch (_state) {
+ case kWaitingForAttach:
+ if (item)
+ showIntakeInProgress(0);
+ break;
+ case kWaitingForDispense:
+ dispenseGas();
+ break;
+ default:
+ break;
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/fillingstation.h b/engines/pegasus/neighborhood/norad/alpha/fillingstation.h
new file mode 100644
index 0000000000..eb2088e373
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/fillingstation.h
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_FILLINGSTATION_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_FILLINGSTATION_H
+
+#include "pegasus/interaction.h"
+#include "pegasus/movie.h"
+#include "pegasus/notification.h"
+
+namespace Pegasus {
+
+class Item;
+
+class NoradAlphaFillingStation : public GameInteraction, public NotificationReceiver {
+public:
+ NoradAlphaFillingStation(Neighborhood *);
+ virtual ~NoradAlphaFillingStation() {}
+
+ virtual void handleInput(const Input &, const Hotspot *);
+
+ virtual void clickInHotspot(const Input &, const Hotspot *);
+ virtual void activateHotspots();
+
+ void newFillingItem(Item *);
+
+protected:
+ void receiveNotification(Notification *, const NotificationFlags);
+
+ virtual void openInteraction();
+ virtual void initInteraction();
+ virtual void closeInteraction();
+
+ void powerUpFinished();
+ void splashFinished();
+ void intakeWarningFinished();
+ void intakeHighlightFinished();
+ void dispenseHighlightFinished();
+ void ArHighlightFinished();
+ void CO2HighlightFinished();
+ void HeHighlightFinished();
+ void OHighlightFinished();
+ void NHighlightFinished();
+
+ void showIntakeInProgress(uint16);
+
+ void clickInIntake();
+ void clickInDispense();
+ void clickInAr();
+ void clickInCO2();
+ void clickInHe();
+ void clickInO();
+ void clickInN();
+
+ void dispenseGas();
+
+ void setStaticState(TimeValue, int16);
+ void setSegmentState(TimeValue, TimeValue, NotificationFlags, int16);
+
+ Movie _rightSideMovie;
+ Notification _rightSideNotification;
+ NotificationCallBack _rightSideCallBack;
+ int16 _state;
+ ItemID _dispenseItemID;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp
new file mode 100644
index 0000000000..793d8ffb59
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/noradalpha.cpp
@@ -0,0 +1,763 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pegasus/energymonitor.h"
+#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
+#include "pegasus/ai/ai_area.h"
+#include "pegasus/items/inventory/airmask.h"
+#include "pegasus/neighborhood/norad/constants.h"
+#include "pegasus/neighborhood/norad/subcontrolroom.h"
+#include "pegasus/neighborhood/norad/alpha/ecrmonitor.h"
+#include "pegasus/neighborhood/norad/alpha/fillingstation.h"
+#include "pegasus/neighborhood/norad/alpha/noradalpha.h"
+
+namespace Pegasus {
+
+const uint32 NoradAlpha::_noradAlphaClawExtras[22] = {
+ kN22ClawFromAToB,
+ kN22ClawALoop,
+ kN22ClawAPinch,
+ kN22ClawACounterclockwise,
+ kN22ClawAClockwise,
+ kN22ClawFromBToA,
+ kN22ClawFromBToC,
+ kN22ClawFromBToD,
+ kN22ClawBLoop,
+ kN22ClawBPinch,
+ kN22ClawBCounterclockwise,
+ kN22ClawBClockwise,
+ kN22ClawFromCToB,
+ kN22ClawCLoop,
+ kN22ClawCPinch,
+ kN22ClawCCounterclockwise,
+ kN22ClawCClockwise,
+ kN22ClawFromDToB,
+ kN22ClawDLoop,
+ kN22ClawDPinch,
+ kN22ClawDCounterclockwise,
+ kN22ClawDClockwise
+};
+
+NoradAlpha::NoradAlpha(InputHandler *nextHandler, PegasusEngine *owner) : Norad(nextHandler, owner, "Norad Alpha", kNoradAlphaID) {
+ _elevatorUpRoomID = kNorad11South;
+ _elevatorDownRoomID = kNorad12South;
+ _elevatorUpSpotID = kNorad12ElevatorUpSpotID;
+ _elevatorDownSpotID = kNorad11ElevatorDownSpotID;
+
+ _subRoomEntryRoom1 = kNorad10;
+ _subRoomEntryDir1 = kEast;
+ _subRoomEntryRoom2 = kNorad21;
+ _subRoomEntryDir2 = kWest;
+ _upperPressureDoorRoom = kNorad10East;
+ _lowerPressureDoorRoom = kNorad21West;
+
+ _upperPressureDoorUpSpotID = kAlphaUpperPressureDoorUpSpotID;
+ _upperPressureDoorDownSpotID = kAlphaUpperPressureDoorDownSpotID;
+ _upperPressureDoorAbortSpotID = kNorad10EastOutSpotID;
+
+ _lowerPressureDoorUpSpotID = kAlphaLowerPressureDoorUpSpotID;
+ _lowerPressureDoorDownSpotID = kAlphaLowerPressureDoorDownSpotID;
+ _lowerPressureDoorAbortSpotID = kNorad21WestOutSpotID;
+
+ _pressureSoundIn = kPressureDoorIntro1In;
+ _pressureSoundOut = kPressureDoorIntro1Out;
+ _equalizeSoundIn = kPressureDoorIntro2In;
+ _equalizeSoundOut = kPressureDoorIntro2Out;
+ _accessDeniedIn = kAlphaAccessDeniedIn;
+ _accessDeniedOut = kAlphaAccessDeniedOut;
+
+ _platformRoom = kNorad19West;
+ _subControlRoom = kNorad22West;
+
+ _subPrepFailed = false;
+
+ setIsItemTaken(kGasCanister);
+}
+
+void NoradAlpha::init() {
+ Norad::init();
+
+ Hotspot *hotspot = _vm->getAllHotspots().findHotspotByID(kN01GasCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ HotspotInfoTable::Entry *hotspotEntry = findHotspotEntry(kN01GasCanisterSpotID);
+ hotspotEntry->hotspotItem = kGasCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01ArgonCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01ArgonCanisterSpotID);
+ hotspotEntry->hotspotItem = kArgonCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01NitrogenCanisterSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01NitrogenCanisterSpotID);
+ hotspotEntry->hotspotItem = kNitrogenCanister;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01AirMaskSpotID);
+ hotspot->setMaskedHotspotFlags(kPickUpItemSpotFlag, kPickUpItemSpotFlag);
+ hotspotEntry = findHotspotEntry(kN01AirMaskSpotID);
+ hotspotEntry->hotspotItem = kAirMask;
+
+ hotspot = _vm->getAllHotspots().findHotspotByID(kN01GasOutletSpotID);
+ hotspot->setMaskedHotspotFlags(kDropItemSpotFlag, kDropItemSpotFlag);
+}
+
+void NoradAlpha::start() {
+ if (g_energyMonitor) {
+ g_energyMonitor->stopEnergyDraining();
+ g_energyMonitor->restoreLastEnergyValue();
+ _vm->resetEnergyDeathReason();
+ g_energyMonitor->startEnergyDraining();
+ }
+
+ NeighborhoodID itemNeighborhood;
+ RoomID itemRoom;
+ DirectionConstant itemDirection;
+
+ Item *item = (Item *)_vm->getAllItems().findItemByID(kGasCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kAirMask);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kNitrogenCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+
+ if (itemNeighborhood == getObjectID()) {
+ _fillingStationItem = item;
+ } else {
+ item = (Item *)_vm->getAllItems().findItemByID(kArgonCanister);
+ item->getItemRoom(itemNeighborhood, itemRoom, itemDirection);
+ if (itemNeighborhood == getObjectID())
+ _fillingStationItem = item;
+ else
+ _fillingStationItem = 0;
+ }
+ }
+ }
+
+ if (!GameState.getNoradGassed())
+ forceStridingStop(kNorad03, kEast, kAltNoradAlphaNormal);
+
+ GameState.setNoradArrivedFromSub(false);
+ Norad::start();
+}
+
+void NoradAlpha::setUpAIRules() {
+ Neighborhood::setUpAIRules();
+
+ if (g_AIArea) {
+ AIPlayMessageAction *messageAction = new AIPlayMessageAction("Images/AI/Norad/XN01WD1", false);
+ AIHasItemCondition *hasGasCanisterCondition = new AIHasItemCondition(kGasCanister);
+ AIRule *rule = new AIRule(hasGasCanisterCondition, messageAction);
+ g_AIArea->addAIRule(rule);
+ }
+}
+
+bool NoradAlpha::okayToJump() {
+ bool result = Neighborhood::okayToJump();
+
+ if (!result)
+ playSpotSoundSync(kAlphaCantTransportIn, kAlphaCantTransportOut);
+
+ return result;
+}
+
+void NoradAlpha::getExtraCompassMove(const ExtraTable::Entry &entry, FaderMoveSpec &compassMove) {
+ if (entry.extra == kNorad19ExitToSub) {
+ compassMove.makeTwoKnotFaderSpec(kNoradAlphaMovieScale, entry.movieStart, 270 + kSubPlatformCompassAngle,
+ entry.movieEnd, 90 + 20 + 360);
+ compassMove.insertFaderKnot(entry.movieStart + 10 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle);
+ compassMove.insertFaderKnot(entry.movieStart + 29 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 52 * kNoradAlphaFrameDuration, 270 + kSubPlatformCompassAngle + 20);
+ compassMove.insertFaderKnot(entry.movieStart + 84 * kNoradAlphaFrameDuration, 360 + 90);
+ compassMove.insertFaderKnot(entry.movieStart + 198 * kNoradAlphaFrameDuration, 360 + 90);
+ compassMove.insertFaderKnot(entry.movieStart + 270 * kNoradAlphaFrameDuration, 360 + 90 + 15);
+ compassMove.insertFaderKnot(entry.movieStart + 280 * kNoradAlphaFrameDuration, 360 + 90 + 20);
+ } else {
+ Norad::getExtraCompassMove(entry, compassMove);
+ }
+}
+
+void NoradAlpha::playClawMonitorIntro() {
+ playSpotSoundSync(kLoadClawIntroIn, kLoadClawIntroOut);
+}
+
+GameInteraction *NoradAlpha::makeInteraction(const InteractionID interactionID) {
+ switch (interactionID) {
+ case kNoradECRMonitorInteractionID:
+ return new NoradAlphaECRMonitor(this);
+ case kNoradFillingStationInteractionID:
+ return new NoradAlphaFillingStation(this);
+ }
+
+ return Norad::makeInteraction(interactionID);
+}
+
+void NoradAlpha::loadAmbientLoops() {
+ // clone2727 would like to point out that the following comment does not quite
+ // match the code logic below
+
+/*
+ Logic:
+
+ loop sound 1:
+ if gassed,
+ play warning loop of some sort
+ else
+ play nothing
+ loop sound 2:
+ if gassed and not wearing air mask
+ if in ECR
+ play breathing water loop
+ else
+ play breathing
+ else
+ if in ECR
+ play water loop
+ if at N07 north
+ play unmanned loop
+*/
+
+ if (!GameState.getNoradSeenTimeStream())
+ return;
+
+ RoomID room = GameState.getCurrentRoom();
+ if (GameState.getNoradGassed()) {
+ if (room >= kNorad11 && room <= kNorad19West)
+ loadLoopSound1("Sounds/Norad/NEW SUB AMB.22K.AIFF", kNoradWarningVolume * 3);
+ else if (room >= kNorad21 && room <= kNorad22West)
+ loadLoopSound1("Sounds/Norad/SUB CONTRL LOOP.22K.AIFF", kNoradWarningVolume * 3);
+ else
+ loadLoopSound1("Sounds/Norad/WARNING LOOP.22K.AIFF", kNoradWarningVolume);
+ } else {
+ loadLoopSound1("");
+ }
+
+ if (GameState.getNoradGassed() && !g_airMask->isAirFilterOn()) {
+ if (room >= kNorad01 && room <= kNorad01West) {
+ loadLoopSound2("Sounds/Norad/Breathing Water.22K.AIFF", kNoradSuckWindVolume);
+ } else if (room == kNorad02) {
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Norad/Breathing Water.22K.AIFF", kNoradSuckWindVolume);
+ else
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", kNoradSuckWindVolume, 0, 0);
+ } else {
+ loadLoopSound2("Sounds/Norad/SUCKING WIND.22K.AIFF", kNoradSuckWindVolume, 0, 0);
+ }
+ } else {
+ if (room >= kNorad01 && room <= kNorad01West) {
+ loadLoopSound2("Sounds/Norad/WATER FLOWING.AIFF", 0x100 / 2);
+ } else if (room == kNorad02) {
+ if (GameState.isCurrentDoorOpen())
+ loadLoopSound2("Sounds/Norad/WATER FLOWING.AIFF", 0x100 / 2);
+ else
+ loadLoopSound2("");
+ } else {
+ loadLoopSound2("");
+ }
+ }
+
+}
+
+void NoradAlpha::checkContinuePoint(const RoomID room, const DirectionConstant direction) {
+ switch (MakeRoomView(room, direction)) {
+ case MakeRoomView(kNorad02, kEast):
+ case MakeRoomView(kNorad06, kEast):
+ case MakeRoomView(kNorad11, kEast):
+ case MakeRoomView(kNorad15, kEast):
+ case MakeRoomView(kNorad19, kWest):
+ case MakeRoomView(kNorad21, kSouth):
+ makeContinuePoint();
+ break;
+ }
+}
+
+void NoradAlpha::arriveAt(const RoomID room, const DirectionConstant direction) {
+ Norad::arriveAt(room, direction);
+
+ switch (GameState.getCurrentRoom()) {
+ case kNorad01:
+ arriveAtNorad01();
+ break;
+ case kNorad01East:
+ arriveAtNorad01East();
+ break;
+ case kNorad01West:
+ arriveAtNorad01West();
+ break;
+ case kNorad04:
+ arriveAtNorad04();
+ break;
+ case kNorad07North:
+ GameState.setScoringSawUnconsciousOperator(true);
+ break;
+ case kNorad11:
+ GameState.setScoringWentThroughPressureDoor(true);
+ break;
+ case kNorad22:
+ arriveAtNorad22();
+ break;
+ }
+}
+
+void NoradAlpha::arriveAtNorad01() {
+ if (!GameState.getNoradSeenTimeStream() && GameState.getCurrentDirection() == kSouth) {
+ GameState.setNoradN22MessagePlayed(false);
+ requestExtraSequence(kNoradArriveFromTSA, kExtraCompletedFlag, kFilterNoInput);
+ // You are no match for me, human.
+ requestExtraSequence(kNorad01RobotTaunt, kExtraCompletedFlag, kFilterNoInput);
+ }
+}
+
+void NoradAlpha::arriveAtNorad01East() {
+ GameState.setScoringSawSecurityMonitor(true);
+ newInteraction(kNoradECRMonitorInteractionID);
+}
+
+void NoradAlpha::arriveAtNorad01West() {
+ newInteraction(kNoradFillingStationInteractionID);
+}
+
+void NoradAlpha::arriveAtNorad04() {
+ if (GameState.getCurrentDirection() == kEast && !GameState.getNoradGassed())
+ playDeathExtra(kNorad04EastDeath, kDeathWokeUpNorad);
+}
+
+void NoradAlpha::arriveAtNorad22() {
+ if (!GameState.getNoradN22MessagePlayed() && GameState.getCurrentDirection() == kSouth) {
+ startExtraSequence(kNorad22SouthIntro, kExtraCompletedFlag, kFilterNoInput);
+ GameState.setNoradN22MessagePlayed(true);
+ }
+}
+
+void NoradAlpha::bumpIntoWall() {
+ requestSpotSound(kAlphaBumpIntoWallIn, kAlphaBumpIntoWallOut, kFilterNoInput, 0);
+ Neighborhood::bumpIntoWall();
+}
+
+void NoradAlpha::receiveNotification(Notification *notification, const NotificationFlags flags) {
+ if ((flags & kExtraCompletedFlag) != 0) {
+ switch (_lastExtra) {
+ case kNoradArriveFromTSA:
+ GameState.setNoradSeenTimeStream(true);
+ loadAmbientLoops();
+ break;
+ case kNorad01RobotTaunt:
+ g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Norad/XN01SB", false, kWarningInterruption);
+ _interruptionFilter = kFilterAllInput;
+ makeContinuePoint();
+ break;
+ }
+ }
+
+ Norad::receiveNotification(notification, flags);
+
+ if ((flags & kExtraCompletedFlag) != 0) {
+ switch (_lastExtra) {
+ case kNorad22SouthIntro:
+ loopExtraSequence(kNorad22SouthReply);
+ playSpotSoundSync(kN22ReplyIn, kN22ReplyOut);
+ startExtraSequence(kNorad22SouthFinish, kExtraCompletedFlag, kFilterNoInput);
+ break;
+ case kNorad22SouthFinish:
+ _interruptionFilter = kFilterAllInput;
+ // Force ArriveAt to do its thing...
+ GameState.setCurrentRoom(kNorad21);
+ arriveAt(kNorad22, kSouth);
+ break;
+ }
+ }
+
+ g_AIArea->checkMiddleArea();
+}
+
+void NoradAlpha::getZoomEntry(const HotSpotID spotID, ZoomTable::Entry &entry) {
+ Norad::getZoomEntry(spotID, entry);
+
+ ExtraTable::Entry extra;
+
+ if (spotID == kNorad01GasSpotID) {
+ if (_fillingStationItem) {
+ if (_fillingStationItem->getObjectID() == kGasCanister) {
+ getExtraEntry(kNorad01ZoomInWithGasCanister, extra);
+ entry.movieStart = extra.movieStart;
+ entry.movieEnd = extra.movieEnd;
+ } else {
+ entry.clear();
+ }
+ }
+ } else if (spotID == kNorad01GasOutSpotID) {
+ if (_fillingStationItem) {
+ if (_fillingStationItem->getObjectID() == kGasCanister) {
+ getExtraEntry(kNorad01ZoomOutWithGasCanister, extra);
+ entry.movieStart = extra.movieStart;
+ entry.movieEnd = extra.movieEnd;
+ } else {
+ entry.clear();
+ }
+ }
+ }
+}
+
+TimeValue NoradAlpha::getViewTime(const RoomID room, const DirectionConstant direction) {
+ ExtraTable::Entry entry;
+
+ if (room == kNorad01 && direction == kSouth && !GameState.getNoradSeenTimeStream()) {
+ getExtraEntry(kNoradArriveFromTSA, entry);
+ return entry.movieStart;
+ }
+
+ if (room == kNorad01 && direction == kWest) {
+ if (!_fillingStationItem) {
+ return Norad::getViewTime(room, direction);
+ } else {
+ getExtraEntry(kN01WGasCanister, entry);
+ return entry.movieStart;
+ }
+ } else if (room == kNorad01West && direction == kWest) {
+ uint32 extraID = 0xffffffff;
+ if (_fillingStationItem) {
+ switch (_fillingStationItem->getObjectID()) {
+ case kArgonCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZArgonCanisterLit;
+ else
+ extraID = kN01WZArgonCanisterDim;
+ break;
+ case kGasCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZGasCanisterLit;
+ else
+ extraID = kN01WZGasCanisterDim;
+ break;
+ case kAirMask:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZAirMaskLit;
+ else
+ extraID = kN01WZAirMaskDim;
+ break;
+ case kNitrogenCanister:
+ if (GameState.getNoradFillingStationOn())
+ extraID = kN01WZNitrogenCanisterLit;
+ else
+ extraID = kN01WZNitrogenCanisterDim;
+ break;
+ default:
+ // Should never happen.
+ break;
+ }
+ } else if (GameState.getNoradFillingStationOn()) {
+ extraID = kN01WZEmptyLit;
+ }
+
+ if (extraID == 0xffffffff) {
+ return Norad::getViewTime(room, direction);
+ } else {
+ getExtraEntry(extraID, entry);
+ return entry.movieStart;
+ }
+ }
+
+ return Norad::getViewTime(room, direction);
+}
+
+void NoradAlpha::turnOnFillingStation() {
+ if (GameState.getCurrentRoom() == kNorad01West && !GameState.getNoradFillingStationOn()) {
+ GameState.setNoradFillingStationOn(true);
+ updateViewFrame();
+ }
+}
+
+void NoradAlpha::turnOffFillingStation() {
+ if (GameState.getCurrentRoom() == kNorad01West && GameState.getNoradFillingStationOn()) {
+ GameState.setNoradFillingStationOn(false);
+ updateViewFrame();
+ }
+}
+
+void NoradAlpha::activateHotspots() {
+ Norad::activateHotspots();
+
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01West, kWest):
+ if (_vm->getDragType() == kDragInventoryUse) {
+ if (!_fillingStationItem) {
+ ItemID itemID = _vm->getDraggingItem()->getObjectID();
+ if (itemID == kArgonCanister || itemID == kGasCanister || itemID == kAirMask ||
+ itemID == kNitrogenCanister)
+ _vm->getAllHotspots().activateOneHotspot(kN01GasOutletSpotID);
+ }
+ } else {
+ HotSpotID spotID;
+
+ if (_fillingStationItem) {
+ switch (_fillingStationItem->getObjectID()) {
+ case kArgonCanister:
+ spotID = kN01ArgonCanisterSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ case kGasCanister:
+ spotID = kN01GasCanisterSpotID;
+ break;
+ case kAirMask:
+ spotID = kN01AirMaskSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ case kNitrogenCanister:
+ spotID = kN01NitrogenCanisterSpotID;
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad01GasOutSpotID);
+ break;
+ default:
+ // Should never happen.
+ spotID = kNoHotSpotID;
+ break;
+ }
+ _vm->getAllHotspots().activateOneHotspot(spotID);
+ }
+ }
+ break;
+ case MakeRoomView(kNorad10, kEast):
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad10DoorSpotID);
+ break;
+ case MakeRoomView(kNorad21, kWest):
+ if (GameState.isCurrentDoorOpen())
+ _vm->getAllHotspots().deactivateOneHotspot(kNorad21WestSpotID);
+ break;
+ }
+}
+
+void NoradAlpha::clickInHotspot(const Input &input, const Hotspot *cursorSpot) {
+ Norad::clickInHotspot(input, cursorSpot);
+
+ if (_vm->getDragType() == kDragInventoryUse) {
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad01West, kWest)) {
+ Item *item = _vm->getDraggingItem();
+ if (item->getObjectID() == kAirMask || item->getObjectID() == kArgonCanister ||
+ item->getObjectID() == kNitrogenCanister || item->getObjectID() == kGasCanister) {
+ HotspotInfoTable::Entry *hotspotEntry = findHotspotEntry(kN01GasOutletSpotID);
+ hotspotEntry->hotspotItem = item->getObjectID();
+ }
+ }
+ }
+}
+
+void NoradAlpha::takeItemFromRoom(Item *item) {
+ if (GameState.getCurrentRoom() == kNorad01West) {
+ if (_fillingStationItem == item) {
+ _fillingStationItem = 0;
+ GameState.setNoradGassed(false);
+ loadAmbientLoops();
+ ((NoradAlphaFillingStation *)_currentInteraction)->newFillingItem(0);
+ forceStridingStop(kNorad03, kEast, kAltNoradAlphaNormal);
+ }
+ }
+
+ Norad::takeItemFromRoom(item);
+}
+
+void NoradAlpha::dropItemIntoRoom(Item *item, Hotspot *droppedSpot) {
+ if (GameState.getCurrentRoom() == kNorad01West) {
+ if (!_fillingStationItem) {
+ _fillingStationItem = item;
+ ((NoradAlphaFillingStation *)_currentInteraction)->newFillingItem(item);
+ }
+ }
+
+ Norad::dropItemIntoRoom(item, droppedSpot);
+}
+
+void NoradAlpha::getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID, HotSpotID &pinchClawSpotID,
+ HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID, HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID,
+ HotSpotID &clawCCWSpotID, HotSpotID &clawCWSpotID, uint32 &clawPosition, const uint32 *&clawExtraIDs) {
+ outSpotID = kNorad22MonitorOutSpotID;
+ prepSpotID = kNorad22LaunchPrepSpotID;
+ clawControlSpotID = kNorad22ClawControlSpotID;
+ pinchClawSpotID = kNorad22ClawPinchSpotID;
+ moveClawDownSpotID = kNorad22ClawDownSpotID;
+ moveClawRightSpotID = kNorad22ClawRightSpotID;
+ moveClawLeftSpotID = kNorad22ClawLeftSpotID;
+ moveClawUpSpotID = kNorad22ClawUpSpotID;
+ clawCCWSpotID = kNorad22ClawCCWSpotID;
+ clawCWSpotID = kNorad22ClawCWSpotID;
+ clawPosition = kClawAtD;
+ clawExtraIDs = _noradAlphaClawExtras;
+}
+
+Hotspot *NoradAlpha::getItemScreenSpot(Item *item, DisplayElement *element) {
+ switch (item->getObjectID()) {
+ case kGasCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01GasCanisterSpotID);
+ case kAirMask:
+ return _vm->getAllHotspots().findHotspotByID(kN01AirMaskSpotID);
+ case kArgonCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01ArgonCanisterSpotID);
+ case kNitrogenCanister:
+ return _vm->getAllHotspots().findHotspotByID(kN01NitrogenCanisterSpotID);
+ }
+
+ return Norad::getItemScreenSpot(item, element);
+}
+
+Common::String NoradAlpha::getEnvScanMovie() {
+ Common::String movieName = Neighborhood::getEnvScanMovie();
+
+ if (movieName.empty()) {
+ RoomID room = GameState.getCurrentRoom();
+ if (room >= kNorad01 && room <= kNorad01West)
+ return "Images/AI/Norad/XNE1";
+ else if ((room >= kNorad02 && room <= kNorad19West))
+ return "Images/AI/Norad/XNE2";
+
+ return "Images/AI/Norad/XNE3";
+ }
+
+ return movieName;
+}
+
+uint NoradAlpha::getNumHints() {
+ uint numHints = Neighborhood::getNumHints();
+
+ if (numHints == 0) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01, kNorth):
+ case MakeRoomView(kNorad01, kSouth):
+ case MakeRoomView(kNorad01, kEast):
+ case MakeRoomView(kNorad01, kWest):
+ case MakeRoomView(kNorad01East, kEast):
+ case MakeRoomView(kNorad01West, kWest):
+ if (GameState.getNoradGassed()) {
+ if (g_airMask->isAirFilterOn())
+ numHints = 0;
+ else
+ numHints = 3;
+ } else {
+ numHints = 2;
+ }
+ break;
+ case MakeRoomView(kNorad19West, kWest):
+ if (getSubPrepFailed() && GameState.getNoradSubPrepState() != kSubPrepped)
+ numHints = 1;
+ break;
+ case MakeRoomView(kNorad22, kWest):
+ numHints = 1;
+ break;
+ }
+ }
+
+ return numHints;
+}
+
+Common::String NoradAlpha::getHintMovie(uint hintNum) {
+ Common::String movieName = Neighborhood::getHintMovie(hintNum);
+
+ if (movieName.empty()) {
+ switch (GameState.getCurrentRoomAndView()) {
+ case MakeRoomView(kNorad01, kNorth):
+ case MakeRoomView(kNorad01, kSouth):
+ case MakeRoomView(kNorad01, kEast):
+ case MakeRoomView(kNorad01, kWest):
+ case MakeRoomView(kNorad01East, kEast):
+ case MakeRoomView(kNorad01West, kWest):
+ switch (hintNum) {
+ case 1:
+ if (GameState.getNoradGassed())
+ return "Images/AI/Norad/XN01SW";
+
+ return "Images/AI/Norad/XN01WD2";
+ case 2:
+ if (GameState.getNoradGassed()) {
+ if (_vm->playerHasItemID(kAirMask))
+ // Mask must not be on if we get here...
+ return "Images/AI/Globals/XGLOB1A";
+
+ return "Images/AI/Globals/XGLOB3D";
+ }
+
+ return "Images/AI/Globals/XGLOB5C";
+ case 3:
+ return "Images/AI/Norad/XN01SH";
+ }
+ break;
+ case MakeRoomView(kNorad19West, kWest):
+ return "Images/AI/Norad/XN19NH";
+ case MakeRoomView(kNorad22, kWest):
+ return "Images/AI/Globals/XGLOB1C";
+ }
+ }
+
+ return movieName;
+}
+
+void NoradAlpha::closeDoorOffScreen(const RoomID room, const DirectionConstant) {
+ switch (room) {
+ case kNorad12:
+ case kNorad13:
+ case kNorad18:
+ case kNorad19:
+ playSpotSoundSync(kAlphaElevatorDoorCloseIn, kAlphaElevatorDoorCloseOut);
+ break;
+ default:
+ playSpotSoundSync(kAlphaRegDoorCloseIn, kAlphaRegDoorCloseOut);
+ break;
+ }
+}
+
+void NoradAlpha::findSpotEntry(const RoomID room, const DirectionConstant direction, SpotFlags flags, SpotTable::Entry &spotEntry) {
+ if (room == kNorad01 && direction == kSouth)
+ spotEntry.clear();
+ else
+ Norad::findSpotEntry(room, direction, flags, spotEntry);
+}
+
+bool NoradAlpha::canSolve() {
+ return Norad::canSolve() || getHintMovie(1) == "Images/AI/Norad/XN01SW";
+}
+
+void NoradAlpha::doSolve() {
+ Norad::doSolve();
+
+ if (getHintMovie(1) == "Images/AI/Norad/XN01SW") {
+ _vm->addItemToInventory(g_airMask);
+ g_airMask->putMaskOn();
+ }
+}
+
+Common::String NoradAlpha::getNavMovieName() {
+ return "Images/Norad Alpha/Norad Alpha.movie";
+}
+
+Common::String NoradAlpha::getSoundSpotsName() {
+ return "Sounds/Norad/Norad Alpha Spots";
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/noradalpha.h b/engines/pegasus/neighborhood/norad/alpha/noradalpha.h
new file mode 100644
index 0000000000..b88a6eb802
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/noradalpha.h
@@ -0,0 +1,115 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_NORADALPHA_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_NORADALPHA_H
+
+#include "pegasus/neighborhood/norad/norad.h"
+
+namespace Pegasus {
+
+class Item;
+
+class NoradAlpha : public Norad {
+public:
+ NoradAlpha(InputHandler *, PegasusEngine *);
+ virtual ~NoradAlpha() {}
+
+ virtual void init();
+ void start();
+
+ virtual bool okayToJump();
+
+ void playClawMonitorIntro();
+
+ void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec &);
+
+ void turnOnFillingStation();
+ void turnOffFillingStation();
+ Item *getFillingItem() { return _fillingStationItem; }
+ bool gasCanisterIntake();
+
+ virtual void takeItemFromRoom(Item *);
+ virtual void dropItemIntoRoom(Item *, Hotspot *);
+
+ virtual GameInteraction *makeInteraction(const InteractionID);
+
+ virtual void getClawInfo(HotSpotID &outSpotID, HotSpotID &prepSpotID, HotSpotID &clawControlSpotID,
+ HotSpotID &pinchClawSpotID, HotSpotID &moveClawDownSpotID, HotSpotID &moveClawRightSpotID,
+ HotSpotID &moveClawLeftSpotID, HotSpotID &moveClawUpSpotID, HotSpotID &clawCCWSpotID,
+ HotSpotID &clawCWSpotID, uint32 &, const uint32 *&);
+
+ void loadAmbientLoops();
+
+ Common::String getEnvScanMovie();
+ uint getNumHints();
+ Common::String getHintMovie(uint);
+ void setUpAIRules();
+
+ void setSubPrepFailed(bool value) { _subPrepFailed = value; }
+ bool getSubPrepFailed() { return _subPrepFailed; }
+
+ void closeDoorOffScreen(const RoomID, const DirectionConstant);
+ void findSpotEntry(const RoomID, const DirectionConstant, SpotFlags, SpotTable::Entry &);
+ void clickInHotspot(const Input &, const Hotspot *);
+
+ void checkContinuePoint(const RoomID, const DirectionConstant);
+
+ bool canSolve();
+ void doSolve();
+
+protected:
+ static const uint32 _noradAlphaClawExtras[22];
+
+ virtual void arriveAtNorad01();
+ virtual void arriveAtNorad01East();
+ virtual void arriveAtNorad01West();
+ virtual void arriveAtNorad04();
+ virtual void arriveAtNorad22();
+
+ virtual void arriveAt(const RoomID, const DirectionConstant);
+
+ virtual void getZoomEntry(const HotSpotID, ZoomTable::Entry &);
+ virtual TimeValue getViewTime(const RoomID, const DirectionConstant);
+
+ virtual void receiveNotification(Notification *, const NotificationFlags);
+
+ virtual void activateHotspots();
+
+ Hotspot *getItemScreenSpot(Item *, DisplayElement *);
+
+ void bumpIntoWall();
+
+ Item *_fillingStationItem;
+
+ bool _subPrepFailed;
+
+ Common::String getSoundSpotsName();
+ Common::String getNavMovieName();
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/panorama.cpp b/engines/pegasus/neighborhood/norad/alpha/panorama.cpp
new file mode 100644
index 0000000000..ecd428239b
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panorama.cpp
@@ -0,0 +1,239 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/macresman.h"
+#include "common/stream.h"
+#include "pegasus/neighborhood/norad/alpha/panorama.h"
+
+namespace Pegasus {
+
+Panorama::Panorama() : _panoramaMovie(kNoDisplayElement) {
+ blankFields();
+}
+
+Panorama::~Panorama() {
+ releasePanorama();
+}
+
+void Panorama::blankFields() {
+ _viewBounds = Common::Rect();
+ _drawBounds = Common::Rect();
+ _mask = 0;
+ _panoramaWidth = 0;
+ _panoramaHeight = 0;
+ _stripWidth = 0;
+ _stripLeft = -1;
+ _stripRight = -1;
+}
+
+void Panorama::releasePanorama() {
+ if (_panoramaMovie.isMovieValid()) {
+ _panoramaMovie.releaseMovie();
+ _panoramaWorld.deallocateSurface();
+ blankFields();
+ }
+}
+
+static const uint32 kPanoramaResType = MKTAG('P', 'a', 'n', 'I'); // Panorama Information.
+static const uint16 kPanoramaResID = 128;
+
+void Panorama::initFromMovieFile(const Common::String &fileName) {
+ // First, we need the resource fork for other reasons -- PanI resource
+ Common::MacResManager *resFork = new Common::MacResManager();
+ if (!resFork->open(fileName) || !resFork->hasResFork())
+ error("Could not open the resource fork of '%s'", fileName.c_str());
+
+ Common::SeekableReadStream *resource = resFork->getResource(kPanoramaResType, kPanoramaResID);
+ if (!resource)
+ error("No panorama information in the resource fork of '%s'", fileName.c_str());
+
+ _panoramaWidth = resource->readUint16BE();
+ _panoramaHeight = resource->readUint16BE();
+ _stripWidth = resource->readUint16BE();
+
+ delete resource;
+ delete resFork;
+
+ // Now we open the movie like normal
+ _panoramaMovie.initFromMovieFile(fileName);
+}
+
+void Panorama::setMask(Surface *mask) {
+ _mask = mask;
+}
+
+// If the panorama is not open, do nothing and return.
+// Otherwise, set up the view bounds.
+void Panorama::setViewBounds(const Common::Rect &newView) {
+ if (!isPanoramaOpen())
+ return;
+
+ if (newView.isEmpty())
+ return;
+
+ Common::Rect r = newView;
+
+ if (r.width() > _panoramaWidth) {
+ r.left = 0;
+ r.right = _panoramaWidth;
+ } else {
+ if (r.right > _panoramaWidth)
+ r.translate(_panoramaWidth - r.right, 0);
+
+ if (r.left < 0)
+ r.translate(-r.left, 0);
+ }
+
+ if (r.height() > _panoramaHeight) {
+ r.top = 0;
+ r.bottom = _panoramaHeight;
+ } else {
+ if (r.bottom > _panoramaHeight)
+ r.translate(0, _panoramaHeight - r.bottom);
+
+ if (r.top < 0)
+ r.translate(0, -r.top);
+ }
+
+ if (_viewBounds != r) {
+ CoordType stripLeft = 0;
+
+ if (r.width() != _viewBounds.width() || !_panoramaWorld.isSurfaceValid()) {
+ _panoramaWorld.deallocateSurface();
+ makeNewSurface(r);
+ } else {
+ CoordType stripRight;
+ calcStripRange(r, stripLeft, stripRight);
+ loadStrips(stripLeft, stripRight);
+ }
+
+ _viewBounds = r;
+ _drawBounds = r;
+ _drawBounds.translate(-stripLeft * _stripWidth, 0);
+ }
+}
+
+void Panorama::getViewBounds(Common::Rect &r) const {
+ r = _viewBounds;
+}
+
+void Panorama::getPanoramaBounds(Common::Rect &r) const {
+ r = Common::Rect(0, 0, _panoramaWidth, _panoramaHeight);
+}
+
+void Panorama::drawPanorama(const Common::Rect &destRect) {
+ if (_panoramaWorld.isSurfaceValid()) {
+ if (_mask)
+ _panoramaWorld.copyToCurrentPortMasked(_drawBounds, destRect, _mask);
+ else
+ _panoramaWorld.copyToCurrentPortTransparent(_drawBounds, destRect);
+ }
+}
+
+// Make a new Surface big enough to show r, which is assumed to be a valid view bounds.
+// Assumptions:
+// r is a valid view bounds.
+// _panoramaWorld is not allocated.
+// _panoramaHeight, _stripWidth is correct.
+// _panoramaMovie is allocated.
+void Panorama::makeNewSurface(const Common::Rect& view) {
+ CoordType stripLeft, stripRight;
+ calcStripRange(view, stripLeft, stripRight);
+
+ Common::Rect r(0, 0, (stripRight - stripLeft + 1) * _stripWidth, _panoramaHeight);
+ _panoramaWorld.allocateSurface(r);
+ _panoramaMovie.shareSurface(&_panoramaWorld);
+ loadStrips(stripLeft, stripRight);
+}
+
+// Assumes view is not empty.
+void Panorama::calcStripRange(const Common::Rect &view, CoordType &stripLeft, CoordType &stripRight) {
+ stripLeft = view.left / _stripWidth;
+ stripRight = (view.left - view.left % _stripWidth + _stripWidth - 1 + view.width()) / _stripWidth;
+}
+
+// Load in all needed strips to put range (stripLeft, stripRight) into the
+// panorama's Surface. Try to optimize by saving any pixels already in the Surface.
+// Assumptions:
+// Surface is allocated and is big enough for maximum range of
+// stripLeft and stripRight
+void Panorama::loadStrips(CoordType stripLeft, CoordType stripRight) {
+ if (_stripLeft == -1) {
+ // Surface has just been allocated.
+ // Load in all strips.
+ for (CoordType i = stripLeft; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+
+ _stripLeft = stripLeft;
+ _stripRight = stripRight;
+ } else if (stripLeft != _stripLeft) {
+ CoordType overlapLeft = MAX(stripLeft, _stripLeft);
+ CoordType overlapRight = MIN(stripRight, _stripRight);
+
+ if (overlapLeft <= overlapRight) {
+ Common::Rect r1((overlapLeft - _stripLeft) * _stripWidth, 0,
+ (overlapRight - _stripLeft + 1) * _stripWidth, _panoramaHeight);
+
+ if (stripLeft < _stripLeft) {
+ Common::Rect bounds;
+ _panoramaWorld.getSurfaceBounds(bounds);
+ _panoramaWorld.getSurface()->move(bounds.right - r1.right, 0, _panoramaHeight);
+
+ for (CoordType i = stripLeft; i < _stripLeft; i++)
+ loadOneStrip(i, stripLeft);
+ } else {
+ _panoramaWorld.getSurface()->move(-r1.left, 0, _panoramaHeight);
+
+ for (CoordType i = _stripRight + 1; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+ }
+ } else {
+ // No overlap.
+ // Load everything.
+ for (CoordType i = stripLeft; i <= stripRight; i++)
+ loadOneStrip(i, stripLeft);
+ }
+
+ _stripLeft = stripLeft;
+ _stripRight = stripRight;
+ } else if (stripRight > _stripRight) {
+ // Need to add one or more strips.
+ for (CoordType i = _stripRight + 1; i <= stripRight; i++)
+ loadOneStrip(i, _stripLeft);
+
+ _stripRight = stripRight;
+ } else if (stripRight < _stripRight) {
+ // Need to chop off one strip.
+ _stripRight = stripRight;
+ }
+}
+
+void Panorama::loadOneStrip(CoordType stripToLoad, CoordType leftStrip) {
+ _panoramaMovie.moveMovieBoxTo((stripToLoad - leftStrip) * _stripWidth, 0);
+ _panoramaMovie.setTime(stripToLoad, 1);
+ _panoramaMovie.redrawMovieWorld();
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/panorama.h b/engines/pegasus/neighborhood/norad/alpha/panorama.h
new file mode 100644
index 0000000000..3ca2c1e305
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panorama.h
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
+
+#include "pegasus/movie.h"
+
+namespace Pegasus {
+
+/*
+
+ Panorama implements a wide image using a specially constructed movie file.
+ The movie holds the image as a series of vertical strips, say 16 or 32 pixels wide.
+
+ The panorama bounds defines the entire panorama. The view bounds represents the
+ area on the panorama that is kept in memory.
+
+ The panorama bounds is also stored in the movie file; it cannot be changed. The
+ view bounds must always be a subset of the panorama bounds.
+
+ In actuality, the area kept in memory is at least as wide as the view bounds (but
+ may be wider to coincide with the width of the movies slices), and is as tall as
+ the panorama bounds. The view bounds is used by the drawPanorama function to draw
+ a piece of the panorama to the current screen.
+
+ The panorama movie is built at a time scale of 1, with each strip lasting for one
+ second, so that strip number corresponds exactly with the time value at which the
+ strip is stored.
+
+ TO USE:
+
+ Call one initFromMovieFile to open the movie. Then set up a view rect by
+ calling setViewBounds. Once these two functions have been called, drawPanorama
+ will draw the panorama.
+
+*/
+
+class Panorama {
+public:
+ Panorama();
+ virtual ~Panorama();
+
+ void initFromMovieFile(const Common::String &);
+ void releasePanorama();
+ bool isPanoramaOpen() { return _panoramaMovie.isMovieValid(); }
+
+ void setViewBounds(const Common::Rect &);
+ void getViewBounds(Common::Rect &) const;
+
+ void setMask(Surface *);
+
+ void getPanoramaBounds(Common::Rect &) const;
+
+ void drawPanorama(const Common::Rect &);
+
+protected:
+ void blankFields();
+ void makeNewSurface(const Common::Rect &);
+ void calcStripRange(const Common::Rect &, CoordType &, CoordType &);
+ void loadStrips(CoordType, CoordType);
+ void loadOneStrip(CoordType, CoordType);
+
+ Movie _panoramaMovie;
+ Surface _panoramaWorld, *_mask;
+ Common::Rect _viewBounds;
+ Common::Rect _drawBounds;
+ CoordType _panoramaWidth, _panoramaHeight;
+ CoordType _stripWidth; // Pixels per strip.
+ CoordType _numStrips;
+ CoordType _stripLeft, _stripRight;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp
new file mode 100644
index 0000000000..fcb49c52ee
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.cpp
@@ -0,0 +1,91 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "pegasus/neighborhood/norad/alpha/panoramascroll.h"
+
+namespace Pegasus {
+
+PanoramaScroll::PanoramaScroll(const DisplayElementID id) : IdlerAnimation(id) {
+ _boundsWidth = 0;
+ _totalWidth = 0;
+}
+
+void PanoramaScroll::initFromMovieFile(const Common::String &fileName) {
+ _panorama.initFromMovieFile(fileName);
+
+ Common::Rect r;
+ _panorama.getPanoramaBounds(r);
+ _totalWidth = r.width();
+}
+
+void PanoramaScroll::initMaskFromPICTFile(const Common::String &fileName) {
+ if (!_panorama.isPanoramaOpen())
+ return;
+
+ _mask.getImageFromPICTFile(fileName);
+ _panorama.setMask(&_mask);
+}
+
+void PanoramaScroll::releasePanorama() {
+ if (_panorama.isPanoramaOpen())
+ _panorama.releasePanorama();
+
+ _mask.deallocateSurface();
+}
+
+void PanoramaScroll::setBounds(const Common::Rect &r) {
+ Animation::setBounds(r);
+
+ _boundsWidth = r.width();
+
+ Common::Rect r2;
+ _panorama.getViewBounds(r2);
+ r2.right = r2.left + _boundsWidth;
+ r2.bottom = r2.top + r.height();
+ _panorama.setViewBounds(r2);
+}
+
+void PanoramaScroll::draw(const Common::Rect &) {
+ _panorama.drawPanorama(_bounds);
+}
+
+void PanoramaScroll::timeChanged(const TimeValue newTime) {
+ CoordType leftPixel = (_totalWidth - _boundsWidth) * newTime / getDuration();
+
+ Common::Rect r;
+ _panorama.getViewBounds(r);
+ if (leftPixel != r.left) {
+ _panorama.getViewBounds(r);
+ r.moveTo(leftPixel, 0);
+ _panorama.setViewBounds(r);
+ triggerRedraw();
+ }
+}
+
+void PanoramaScroll::getPanoramaBounds(Common::Rect &r) const {
+ _panorama.getPanoramaBounds(r);
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h
new file mode 100644
index 0000000000..6a3e1515e2
--- /dev/null
+++ b/engines/pegasus/neighborhood/norad/alpha/panoramascroll.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMASCROLL_H
+#define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMASCROLL_H
+
+#include "pegasus/neighborhood/norad/alpha/panorama.h"
+
+namespace Pegasus {
+
+class PanoramaScroll : public IdlerAnimation {
+public:
+ PanoramaScroll(const DisplayElementID);
+ virtual ~PanoramaScroll() {}
+
+ void initFromMovieFile(const Common::String &);
+ void initMaskFromPICTFile(const Common::String &);
+
+ void releasePanorama();
+
+ bool isPanoramaOpen() { return _panorama.isPanoramaOpen(); }
+ void getPanoramaBounds(Common::Rect &) const;
+
+ void setBounds(const Common::Rect&);
+
+ void draw(const Common::Rect &);
+
+protected:
+ void timeChanged(const TimeValue);
+
+ Panorama _panorama;
+ Surface _mask;
+ CoordType _totalWidth, _boundsWidth;
+};
+
+} // End of namespace Pegasus
+
+#endif