aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/pegasus/module.mk3
-rwxr-xr-xengines/pegasus/neighborhood/mars/mars.cpp226
-rwxr-xr-xengines/pegasus/neighborhood/mars/mars.h258
-rwxr-xr-xengines/pegasus/neighborhood/mars/shuttleenergymeter.cpp116
-rwxr-xr-xengines/pegasus/neighborhood/mars/shuttleenergymeter.h73
-rw-r--r--engines/pegasus/pegasus.h2
6 files changed, 667 insertions, 11 deletions
diff --git a/engines/pegasus/module.mk b/engines/pegasus/module.mk
index c8a67bf53c..c4f0f5efe1 100644
--- a/engines/pegasus/module.mk
+++ b/engines/pegasus/module.mk
@@ -57,8 +57,9 @@ MODULE_OBJS = \
neighborhood/caldoria/caldoria4dsystem.o \
neighborhood/caldoria/caldoriamessages.o \
neighborhood/caldoria/caldoriamirror.o \
- neighborhood/mars/reactor.o \
neighborhood/mars/mars.o \
+ neighborhood/mars/reactor.o \
+ neighborhood/mars/shuttleenergymeter.o \
neighborhood/norad/norad.o \
neighborhood/norad/noradelevator.o \
neighborhood/norad/pressuredoor.o \
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index f13890cc18..7404e1e580 100755
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -23,6 +23,10 @@
*
*/
+#include "common/events.h"
+#include "video/qt_decoder.h"
+
+#include "pegasus/cursor.h"
#include "pegasus/energymonitor.h"
#include "pegasus/gamestate.h"
#include "pegasus/pegasus.h"
@@ -698,9 +702,6 @@ const tExtraID kMars200DeathInBucket = 111;
const tResIDType kReactorUndoHilitePICTID = 900;
-const tCoordType kUndoHiliteLeft = kNavAreaLeft + 140;
-const tCoordType kUndoHiliteTop = kNavAreaTop + 36;
-
const int16 kMars52Compass = 90;
const int16 kMars54Compass = 180;
const int16 kMars56Compass = 270;
@@ -766,10 +767,18 @@ void airStageExpiredFunction(FunctionPtr *, void *mars) {
((Mars *)mars)->airStageExpired();
}
+void marsTimerFunction(FunctionPtr *, void *event) {
+ ((MarsTimerEvent *)event)->mars->marsTimerExpired(*(MarsTimerEvent *)event);
+}
+
Mars::Mars(InputHandler *nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Mars", kMarsID),
_guessObject(kNoDisplayElement), _undoPict(kNoDisplayElement), _guessHistory(kNoDisplayElement),
_choiceHighlight(kNoDisplayElement), _shuttleInterface1(kNoDisplayElement), _shuttleInterface2(kNoDisplayElement),
- _shuttleInterface3(kNoDisplayElement), _shuttleInterface4(kNoDisplayElement), _canyonChaseMovie(kNoDisplayElement) {
+ _shuttleInterface3(kNoDisplayElement), _shuttleInterface4(kNoDisplayElement), _canyonChaseMovie(kNoDisplayElement),
+ _leftShuttleMovie(kNoDisplayElement), _rightShuttleMovie(kNoDisplayElement), _lowerLeftShuttleMovie(kNoDisplayElement),
+ _lowerRightShuttleMovie(kNoDisplayElement), _centerShuttleMovie(kNoDisplayElement),
+ _upperLeftShuttleMovie(kNoDisplayElement), _upperRightShuttleMovie(kNoDisplayElement),
+ _leftDamageShuttleMovie(kNoDisplayElement), _rightDamageShuttleMovie(kNoDisplayElement) {
_noAirFuse.setFunctionPtr(&airStageExpiredFunction, this);
setIsItemTaken(kMarsCard);
setIsItemTaken(kAirMask);
@@ -2980,7 +2989,7 @@ void Mars::receiveNotification(Notification *notification, const tNotificationFl
break;
}
} else if ((flag & kTimeForCanyonChaseFlag) != 0) {
- // TODO
+ doCanyonChase();
} else if ((flag & kExplosionFinishedFlag) != 0) {
// TODO
} else if ((flag & kTimeToTransportFlag) != 0) {
@@ -2998,6 +3007,213 @@ void Mars::spotCompleted() {
g_AIArea->playAIMovie(kRightAreaSignature, "Images/AI/Mars/XN59WD", false, kWarningInterruption);
}
+void Mars::doCanyonChase() {
+ GameState.setScoringEnteredShuttle();
+ setNextHandler(_vm);
+ throwAwayInterface();
+
+ _vm->_cursor->hide();
+
+ // Open the spot sounds movie again...
+ _spotSounds.initFromQuickTime(getSoundSpotsName());
+ _spotSounds.setVolume(_vm->getSoundFXLevel());
+
+ Video::VideoDecoder *video = new Video::QuickTimeDecoder();
+ if (!video->loadFile("Images/Mars/M44ESA.movie"))
+ error("Could not load interface->shuttle transition video");
+
+ while (!_vm->shouldQuit() && !video->endOfVideo()) {
+ if (video->needsUpdate()) {
+ const Graphics::Surface *frame = video->decodeNextFrame();
+
+ if (frame)
+ _vm->drawScaledFrame(frame, 0, 0);
+ }
+
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event))
+ ;
+
+ g_system->delayMillis(10);
+ }
+
+ delete video;
+
+ if (_vm->shouldQuit())
+ return;
+
+ initOnePicture(&_shuttleInterface1, "Images/Mars/MCmain1.pict", kShuttleBackgroundOrder, kShuttle1Left,
+ kShuttle1Top, true);
+ initOnePicture(&_shuttleInterface2, "Images/Mars/MCmain2.pict", kShuttleBackgroundOrder, kShuttle2Left,
+ kShuttle2Top, true);
+ initOnePicture(&_shuttleInterface3, "Images/Mars/MCmain3.pict", kShuttleBackgroundOrder, kShuttle3Left,
+ kShuttle3Top, true);
+ initOnePicture(&_shuttleInterface4, "Images/Mars/MCmain4.pict", kShuttleBackgroundOrder, kShuttle4Left,
+ kShuttle4Top, true);
+
+ initOneMovie(&_canyonChaseMovie, "Images/Mars/Canyon.movie",
+ kShuttleMonitorOrder, kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.setVolume(_vm->getSoundFXLevel());
+
+ loadLoopSound1("Sounds/Mars/Inside Cockpit.22K.8.AIFF");
+
+ // Swing shuttle around...
+ playMovieSegment(&_canyonChaseMovie, kShuttleSwingStart, kShuttleSwingStop);
+
+ initOneMovie(&_leftShuttleMovie, "Images/Mars/Left Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleLeftLeft, kShuttleLeftTop, false);
+
+ initOneMovie(&_rightShuttleMovie, "Images/Mars/Right Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleRightLeft, kShuttleRightTop, false);
+
+ initOneMovie(&_lowerLeftShuttleMovie, "Images/Mars/Lower Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerLeftLeft, kShuttleLowerLeftTop, false);
+
+ initOneMovie(&_lowerRightShuttleMovie, "Images/Mars/Lower Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleLowerRightLeft, kShuttleLowerRightTop, false);
+
+ initOneMovie(&_centerShuttleMovie, "Images/Mars/Center Shuttle.movie",
+ kShuttleMonitorOrder, kShuttleCenterLeft, kShuttleCenterTop, false);
+
+ initOneMovie(&_upperLeftShuttleMovie, "Images/Mars/Upper Left Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperLeftLeft, kShuttleUpperLeftTop, false);
+
+ initOneMovie(&_upperRightShuttleMovie, "Images/Mars/Upper Right Shuttle.movie", kShuttleMonitorOrder,
+ kShuttleUpperRightLeft, kShuttleUpperRightTop, false);
+
+ initOneMovie(&_leftDamageShuttleMovie, "Images/Mars/Left Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleLeftEnergyLeft, kShuttleLeftEnergyTop, false);
+
+ initOneMovie(&_rightDamageShuttleMovie, "Images/Mars/Right Damage Shuttle.movie",
+ kShuttleStatusOrder, kShuttleRightEnergyLeft, kShuttleRightEnergyTop, false);
+
+ _centerShuttleMovie.show();
+ _centerShuttleMovie.setTime(kShuttleCenterBoardingTime);
+ playSpotSoundSync(kShuttleCockpitIn, kShuttleCockpitOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterCheckTime);
+ playSpotSoundSync(kShuttleOnboardIn, kShuttleOnboardOut);
+
+ _shuttleEnergyMeter.initShuttleEnergyMeter();
+ _shuttleEnergyMeter.powerUpMeter();
+ while (_shuttleEnergyMeter.isFading()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ g_system->updateScreen();
+ }
+
+ _leftShuttleMovie.show();
+ playMovieSegment(&_leftShuttleMovie, kShuttleLeftIntroStart, kShuttleLeftIntroStop);
+
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _leftDamageShuttleMovie.show();
+ playMovieSegment(&_leftDamageShuttleMovie);
+
+ // Take it down a tick initially. This sets the time to the time of the last tick,
+ // so that subsequence drops will drop it down a tick.
+ _leftDamageShuttleMovie.setTime(_leftDamageShuttleMovie.getTime() - 40);
+
+ _lowerRightShuttleMovie.show();
+ _lowerRightShuttleMovie.setTime(kShuttleLowerRightOffTime);
+ _lowerRightShuttleMovie.redrawMovieWorld();
+ _centerShuttleMovie.setTime(kShuttleCenterNavCompTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleNavigationIn, kShuttleNavigationOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterCommTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleCommunicationIn, kShuttleCommunicationOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterAllSystemsTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleAllSystemsIn, kShuttleAllSystemsOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterSecureLooseTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleSecureLooseIn, kShuttleSecureLooseOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterAutoTestTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttleAutoTestingIn, kShuttleAutoTestingOut);
+
+ _leftShuttleMovie.setTime(kShuttleLeftAutoTestTime);
+ _leftShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kMarsThrusterAutoTestIn, kMarsThrusterAutoTestOut);
+ _leftShuttleMovie.setTime(kShuttleLeftNormalTime);
+ _leftShuttleMovie.redrawMovieWorld();
+
+ _centerShuttleMovie.setTime(kShuttleCenterLaunchTime);
+ _centerShuttleMovie.redrawMovieWorld();
+ playSpotSoundSync(kShuttlePrepareForDropIn, kShuttlePrepareForDropOut);
+
+ playSpotSoundSync(kShuttleAllClearIn, kShuttleAllClearOut);
+
+ _centerShuttleMovie.setTime(kShuttleCenterEnterTubeTime);
+ _centerShuttleMovie.redrawMovieWorld();
+
+ _lowerLeftShuttleMovie.show();
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftCollisionTime);
+
+ loadLoopSound1("");
+
+ _canyonChaseMovie.setSegment(kCanyonChaseStart, kCanyonChaseStop);
+ _canyonChaseMovie.start();
+
+ startMarsTimer(kLaunchTubeReachedTime, kMovieTicksPerSecond, kMarsLaunchTubeReached);
+}
+
+void Mars::setSoundFXLevel(const uint16 level) {
+ Neighborhood::setSoundFXLevel(level);
+
+ if (_canyonChaseMovie.isMovieValid())
+ _canyonChaseMovie.setVolume(level);
+
+ // TODO: Explosions
+}
+
+void Mars::startMarsTimer(TimeValue time, TimeScale scale, MarsTimerCode code) {
+ _utilityFuse.primeFuse(time, scale);
+ _marsEvent.mars = this;
+ _marsEvent.event = code;
+ _utilityFuse.setFunctionPtr(&marsTimerFunction, (void *)&_marsEvent);
+ _utilityFuse.lightFuse();
+}
+
+void Mars::marsTimerExpired(MarsTimerEvent &event) {
+ switch (event.event) {
+ case kMarsLaunchTubeReached:
+ _lowerLeftShuttleMovie.setTime(kShuttleLowerLeftTubeTime);
+ _lowerLeftShuttleMovie.redrawMovieWorld();
+ startMarsTimer(kCanyonChaseFinishedTime, kMovieTicksPerSecond, kMarsCanyonChaseFinished);
+ break;
+ case kMarsCanyonChaseFinished:
+ GameState.setScoringEnteredLaunchTube();
+
+ while (_canyonChaseMovie.isRunning()) {
+ _vm->checkCallBacks();
+ _vm->refreshDisplay();
+ _vm->_system->delayMillis(10);
+ }
+
+ _canyonChaseMovie.stop();
+ _canyonChaseMovie.stopDisplaying();
+ _canyonChaseMovie.releaseMovie();
+
+ error("STUB: Space chase");
+ break;
+ case kMarsSpaceChaseFinished:
+ // Player failed to stop the robot in time...
+ // TODO
+ break;
+ default:
+ break;
+ }
+
+ _interruptionFilter = kFilterAllInput;
+}
+
tAirQuality Mars::getAirQuality(const tRoomID room) {
if ((room >= kMars36 && room <= kMars39) || (room >= kMarsMaze004 && room <= kMarsMaze200))
return kAirQualityVacuum;
diff --git a/engines/pegasus/neighborhood/mars/mars.h b/engines/pegasus/neighborhood/mars/mars.h
index b663a621af..1b29cdfc1e 100755
--- a/engines/pegasus/neighborhood/mars/mars.h
+++ b/engines/pegasus/neighborhood/mars/mars.h
@@ -28,24 +28,254 @@
#include "pegasus/neighborhood/neighborhood.h"
#include "pegasus/neighborhood/mars/reactor.h"
+#include "pegasus/neighborhood/mars/shuttleenergymeter.h"
namespace Pegasus {
+// Element Coordinates
+
+const tCoordType kUndoHiliteLeft = kNavAreaLeft + 140;
+const tCoordType kUndoHiliteTop = kNavAreaTop + 36;
+
+const tCoordType kCurrentGuessLeft = kNavAreaLeft + 146;
+const tCoordType kCurrentGuessTop = kNavAreaTop + 90;
+
+const tCoordType kReactorChoiceHiliteLeft = kNavAreaLeft + 116;
+const tCoordType kReactorChoiceHiliteTop = kNavAreaTop + 158;
+
+const tCoordType kReactorHistoryLeft = kNavAreaLeft + 302;
+const tCoordType kReactorHistoryTop = kNavAreaTop + 39;
+
+const tCoordType kAnswerLeft = kNavAreaLeft + 304;
+const tCoordType kAnswerTop = kNavAreaTop + 180;
+
+const tCoordType kShuttle1Left = 0;
+const tCoordType kShuttle1Top = 0;
+
+const tCoordType kShuttle2Left = 0;
+const tCoordType kShuttle2Top = 96;
+
+const tCoordType kShuttle3Left = 500;
+const tCoordType kShuttle3Top = 96;
+
+const tCoordType kShuttle4Left = 0;
+const tCoordType kShuttle4Top = 320;
+
+const tCoordType kShuttleWindowLeft = 140;
+const tCoordType kShuttleWindowTop = 96;
+const tCoordType kShuttleWindowWidth = 360;
+const tCoordType kShuttleWindowHeight = 224;
+
+const tCoordType kShuttleWindowMidH = (kShuttleWindowLeft * 2 + kShuttleWindowWidth) / 2;
+const tCoordType kShuttleWindowMidV = (kShuttleWindowTop * 2 + kShuttleWindowHeight) / 2;
+
+const tCoordType kShuttleLeftLeft = 0;
+const tCoordType kShuttleLeftTop = 128;
+
+const tCoordType kShuttleRightLeft = 506;
+const tCoordType kShuttleRightTop = 128;
+
+const tCoordType kShuttleLowerLeftLeft = 74;
+const tCoordType kShuttleLowerLeftTop = 358;
+
+const tCoordType kShuttleLowerRightLeft = 486;
+const tCoordType kShuttleLowerRightTop = 354;
+
+const tCoordType kShuttleCenterLeft = 260;
+const tCoordType kShuttleCenterTop = 336;
+
+const tCoordType kShuttleUpperLeftLeft = 30;
+const tCoordType kShuttleUpperLeftTop = 32;
+
+const tCoordType kShuttleUpperRightLeft = 506;
+const tCoordType kShuttleUpperRightTop = 52;
+
+const tCoordType kShuttleLeftEnergyLeft = 110;
+const tCoordType kShuttleLeftEnergyTop = 186;
+
+const tCoordType kShuttleRightEnergyLeft = 510;
+const tCoordType kShuttleRightEnergyTop = 186;
+
+const tCoordType kShuttleEnergyLeft = 186;
+const tCoordType kShuttleEnergyTop = 60;
+const tCoordType kShuttleEnergyWidth = 252;
+const tCoordType kShuttleEnergyHeight = 22;
+
+const tCoordType kPlanetStartLeft = kShuttleWindowLeft;
+const tCoordType kPlanetStartTop = kShuttleWindowTop + kShuttleWindowHeight;
+
+const tCoordType kPlanetStopLeft = kShuttleWindowLeft;
+const tCoordType kPlanetStopTop = kShuttleWindowTop + kShuttleWindowHeight - 100;
+
+const tCoordType kShuttleTractorLeft = kShuttleWindowLeft + 6;
+const tCoordType kShuttleTractorTop = kShuttleWindowTop + 56;
+const tCoordType kShuttleTractorWidth = 348;
+const tCoordType kShuttleTractorHeight = 112;
+
+const tCoordType kShuttleJunkLeft = kShuttleWindowLeft + 6;
+const tCoordType kShuttleJunkTop = kShuttleWindowTop + 6;
+
+const tDisplayOrder kShuttlePlanetOrder = kInterfaceLayer;
+const tDisplayOrder kShuttleAlienShipOrder = kShuttlePlanetOrder + 1;
+const tDisplayOrder kShuttleRobotShipOrder = kShuttleAlienShipOrder + 1;
+const tDisplayOrder kShuttleTractorBeamMovieOrder = kShuttleRobotShipOrder + 1;
+const tDisplayOrder kShuttleWeaponBackOrder = kShuttleTractorBeamMovieOrder + 1;
+const tDisplayOrder kShuttleJunkOrder = kShuttleWeaponBackOrder + 1;
+const tDisplayOrder kShuttleWeaponFrontOrder = kShuttleJunkOrder + 1;
+const tDisplayOrder kShuttleTractorBeamOrder = kShuttleWeaponFrontOrder + 1;
+const tDisplayOrder kShuttleHUDOrder = kShuttleTractorBeamOrder + 1;
+const tDisplayOrder kShuttleBackgroundOrder = kShuttleHUDOrder + 1;
+const tDisplayOrder kShuttleMonitorOrder = kShuttleBackgroundOrder + 1;
+const tDisplayOrder kShuttleStatusOrder = kShuttleMonitorOrder + 1;
+
+const TimeValue kShuttleSwingStart = 0;
+const TimeValue kShuttleSwingStop = 5 * 600;
+
+const TimeValue kCanyonChaseStart = kShuttleSwingStop;
+const TimeValue kCanyonChaseStop = 60 * 600 + 43 * 600 + 14 * 40;
+
+const TimeValue kLaunchTubeReachedTime = 60 * 600 + 38 * 600 - kCanyonChaseStart;
+const TimeValue kCanyonChaseFinishedTime = kCanyonChaseStop - kCanyonChaseStart -
+ kLaunchTubeReachedTime;
+
+// Left shuttle.
+
+const TimeValue kShuttleLeftIntroStart = 0;
+const TimeValue kShuttleLeftIntroStop = 400;
+
+const TimeValue kShuttleLeftBlankTime = 400;
+
+const TimeValue kShuttleLeftNormalTime = 440;
+
+const TimeValue kShuttleLeftAutoTestTime = 480;
+
+const TimeValue kShuttleLeftDamagedTime = 520;
+
+const TimeValue kShuttleLeftDampingTime = 560;
+
+const TimeValue kShuttleLeftGravitonTime = 600;
+
+const TimeValue kShuttleLeftTractorTime = 640;
+
+// Right shuttle.
+
+const TimeValue kShuttleRightIntroStart = 0;
+const TimeValue kShuttleRightIntroStop = 400;
+
+const TimeValue kShuttleRightDestroyedStart = 400;
+const TimeValue kShuttleRightDestroyedStop = 840;
+
+const TimeValue kShuttleRightBlankTime = 840;
+
+const TimeValue kShuttleRightNormalTime = 880;
+
+const TimeValue kShuttleRightDamagedTime = 920;
+
+const TimeValue kShuttleRightTargetLockTime = 960;
+
+const TimeValue kShuttleRightGravitonTime = 1000;
+
+const TimeValue kShuttleRightOverloadTime = 1040;
+
+// Lower Left shuttle.
+
+const TimeValue kShuttleLowerLeftCollisionTime = 0;
+
+const TimeValue kShuttleLowerLeftTubeTime = 40;
+
+const TimeValue kShuttleLowerLeftAutopilotTime = 80;
+
+// Lower Right shuttle.
+
+const TimeValue kShuttleLowerRightOffTime = 0;
+
+const TimeValue kShuttleLowerRightTrackingTime = 40;
+
+const TimeValue kShuttleLowerRightTransportTime = 80;
+
+const TimeValue kShuttleLowerRightTransportHiliteTime = 120;
+
+// Center shuttle.
+
+const TimeValue kShuttleCenterBoardingTime = 0;
+
+const TimeValue kShuttleCenterCheckTime = 40;
+
+const TimeValue kShuttleCenterNavCompTime = 80;
+
+const TimeValue kShuttleCenterCommTime = 120;
+
+const TimeValue kShuttleCenterWeaponsTime = 160;
+
+const TimeValue kShuttleCenterAllSystemsTime = 200;
+
+const TimeValue kShuttleCenterSecureLooseTime = 240;
+
+const TimeValue kShuttleCenterAutoTestTime = 280;
+
+const TimeValue kShuttleCenterLaunchTime = 320;
+
+const TimeValue kShuttleCenterEnterTubeTime = 360;
+
+const TimeValue kShuttleCenterTargetSightedTime = 400;
+
+const TimeValue kShuttleCenterVerifyingTime = 440;
+
+const TimeValue kShuttleCenterScanningTime = 480;
+
+const TimeValue kShuttleCenterSafeTime = 520;
+
+// Upper Left shuttle.
+
+const TimeValue kShuttleUpperLeftDimTime = 0;
+
+const TimeValue kShuttleUpperLeftDampingTime = 40;
+
+const TimeValue kShuttleUpperLeftGravitonTime = 80;
+
+const TimeValue kShuttleUpperLeftTractorTime = 120;
+
+// Upper Right shuttle.
+
+const TimeValue kShuttleUpperRightLockedTime = 0;
+
+const TimeValue kShuttleUpperRightArmedTime = 40;
+
+const TimeValue kShuttleUpperRightAlienDestroyedTime = 80;
+
+const TimeValue kShuttleUpperRightOverloadTime = 120;
+
+const TimeValue kShuttleUpperRightTargetDestroyedTime = 160;
+
+// Shuttle distance
+
+const int kShuttleDistance = 500;
+
+const int kJunkMaxDistance = kShuttleDistance;
+const int kJunkMinDistance = 40;
+
+const int kEnergyBeamMaxDistance = kShuttleDistance;
+const int kEnergyBeamMinDistance = 40;
+
+const int kGravitonMaxDistance = kShuttleDistance;
+const int kGravitonMinDistance = 40;
+
+
class InventoryItem;
class Mars;
-enum tMarsTimerCode {
+enum MarsTimerCode {
kMarsLaunchTubeReached,
kMarsCanyonChaseFinished,
kMarsSpaceChaseFinished // Player ran out of time...
};
-struct tMarsTimerEvent {
+struct MarsTimerEvent {
Mars *mars;
- tMarsTimerCode event;
+ MarsTimerCode event;
};
-enum tShuttleWeaponSelection {
+enum ShuttleWeaponSelection {
kNoWeapon,
kEnergyBeam,
kGravitonCannon,
@@ -68,6 +298,7 @@ friend void lockThawTimerExpiredFunction(FunctionPtr *, void *);
friend void bombTimerExpiredFunction(FunctionPtr *, void *);
friend void bombTimerExpiredInGameFunction(FunctionPtr *, void *);
friend void airStageExpiredFunction(FunctionPtr *, void *);
+friend void marsTimerFunction(FunctionPtr *, void *);
public:
Mars(InputHandler *, PegasusEngine *);
@@ -91,6 +322,8 @@ public:
void checkContinuePoint(const tRoomID, const tDirectionConstant);
+ void setSoundFXLevel(const uint16);
+
bool canSolve();
void doSolve();
@@ -170,6 +403,10 @@ protected:
void timerExpired(const uint32);
void spotCompleted();
+ void doCanyonChase(void);
+ void startMarsTimer(TimeValue, TimeScale, MarsTimerCode);
+ void marsTimerExpired(MarsTimerEvent &);
+
// TODO: Space chase functions
Common::String getSoundSpotsName();
@@ -193,6 +430,19 @@ protected:
Picture _shuttleInterface4;
Movie _canyonChaseMovie;
+ MarsTimerEvent _marsEvent;
+
+ Movie _leftShuttleMovie;
+ Movie _rightShuttleMovie;
+ Movie _lowerLeftShuttleMovie;
+ Movie _lowerRightShuttleMovie;
+ Movie _centerShuttleMovie;
+ Movie _upperLeftShuttleMovie;
+ Movie _upperRightShuttleMovie;
+ Movie _leftDamageShuttleMovie;
+ Movie _rightDamageShuttleMovie;
+ ShuttleEnergyMeter _shuttleEnergyMeter;
+
// TODO: Space chase variables
};
diff --git a/engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp b/engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp
new file mode 100755
index 0000000000..f16735d6a8
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleenergymeter.cpp
@@ -0,0 +1,116 @@
+/* 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/mars/mars.h"
+#include "pegasus/neighborhood/mars/shuttleenergymeter.h"
+
+namespace Pegasus {
+
+ShuttleEnergyMeter::ShuttleEnergyMeter() : FaderAnimation(kNoDisplayElement) {
+ setBounds(kShuttleEnergyLeft, kShuttleEnergyTop, kShuttleEnergyLeft + kShuttleEnergyWidth,
+ kShuttleEnergyTop + kShuttleEnergyHeight);
+ setDisplayOrder(kShuttleStatusOrder);
+ setFaderValue(0);
+}
+
+void ShuttleEnergyMeter::initShuttleEnergyMeter() {
+ _meterImage.getImageFromPICTFile("Images/Mars/Shuttle Energy.pict");
+ _lowWarning.getImageFromPICTFile("Images/Mars/Shuttle Low Energy.pict");
+ startDisplaying();
+ show();
+}
+
+void ShuttleEnergyMeter::disposeShuttleEnergyMeter() {
+ stopFader();
+ hide();
+ stopDisplaying();
+ _meterImage.deallocateSurface();
+ _lowWarning.deallocateSurface();
+}
+
+void ShuttleEnergyMeter::draw(const Common::Rect &) {
+ int32 currentValue = getFaderValue();
+
+ Common::Rect r1, r2, bounds;
+ getBounds(bounds);
+
+ if (currentValue < kLowShuttleEnergy) {
+ _lowWarning.getSurfaceBounds(r1);
+ r2 = r1;
+ r2.moveTo(bounds.left, bounds.top);
+ _lowWarning.copyToCurrentPort(r1, r2);
+ }
+
+ _meterImage.getSurfaceBounds(r1);
+ r1.right = r1.left + r1.width() * currentValue / kFullShuttleEnergy;
+ r2 = r1;
+ r2.moveTo(bounds.left + 102, bounds.top + 6);
+ _meterImage.copyToCurrentPort(r1, r2);
+}
+
+void ShuttleEnergyMeter::powerUpMeter() {
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kThirtyTicksPerSecond, 0, 0, 45, kFullShuttleEnergy);
+ startFader(moveSpec);
+}
+
+void ShuttleEnergyMeter::setEnergyValue(const int32 value) {
+ stopFader();
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kFifteenTicksPerSecond, value * 3, value, kFullShuttleEnergy * 3, kFullShuttleEnergy);
+ startFader(moveSpec);
+}
+
+void ShuttleEnergyMeter::drainForTractorBeam() {
+ stopFader();
+ TimeValue startTime = 0, stopTime;
+ int32 startValue = getFaderValue(), stopValue;
+
+ if (startValue < kTractorBeamEnergy) {
+ stopTime = startValue * kTractorBeamTime / kTractorBeamEnergy;
+ stopValue = 0;
+ } else {
+ stopTime = kTractorBeamTime;
+ stopValue = startValue - kTractorBeamEnergy;
+ }
+
+ FaderMoveSpec moveSpec;
+ moveSpec.makeTwoKnotFaderSpec(kTractorBeamScale, startTime, startValue, stopTime, stopValue);
+ startFader(moveSpec);
+}
+
+int32 ShuttleEnergyMeter::getEnergyValue() const {
+ return getFaderValue();
+}
+
+void ShuttleEnergyMeter::dropEnergyValue(const int32 delta) {
+ setEnergyValue(getFaderValue() - delta);
+}
+
+bool ShuttleEnergyMeter::enoughEnergyForTractorBeam() const {
+ return getEnergyValue() >= kTractorBeamEnergy;
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/neighborhood/mars/shuttleenergymeter.h b/engines/pegasus/neighborhood/mars/shuttleenergymeter.h
new file mode 100755
index 0000000000..169a0f63cd
--- /dev/null
+++ b/engines/pegasus/neighborhood/mars/shuttleenergymeter.h
@@ -0,0 +1,73 @@
+/* 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_MARS_SHUTTLEENERGYMETER_H
+#define PEGASUS_NEIGHBORHOOD_MARS_SHUTTLEENERGYMETER_H
+
+#include "pegasus/fader.h"
+#include "pegasus/surface.h"
+
+namespace Pegasus {
+
+const int32 kFullShuttleEnergy = 100;
+// Low is 20 percent
+const int32 kLowShuttleEnergy = kFullShuttleEnergy * 20 / 100;
+
+const int32 kMinDampingEnergy = 15;
+const int32 kMinGravitonEnergy = 63;
+
+const TimeScale kTractorBeamScale = kFifteenTicksPerSecond;
+const TimeValue kTractorBeamTime = kFiveSeconds * kTractorBeamScale;
+const int32 kTractorBeamEnergy = kLowShuttleEnergy;
+
+class ShuttleEnergyMeter : public FaderAnimation {
+public:
+ ShuttleEnergyMeter();
+ ~ShuttleEnergyMeter() {}
+
+ void initShuttleEnergyMeter();
+ void disposeShuttleEnergyMeter();
+
+ void powerUpMeter();
+
+ void setEnergyValue(const int32);
+ int32 getEnergyValue() const;
+
+ void dropEnergyValue(const int32);
+
+ void drainForTractorBeam();
+
+ bool enoughEnergyForTractorBeam() const;
+
+ void draw(const Common::Rect &);
+
+protected:
+ Surface _meterImage;
+ Surface _lowWarning;
+};
+
+} // End of namespace Pegasus
+
+#endif
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index 13145f3876..f79219447f 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -109,6 +109,7 @@ public:
uint getRandomBit();
uint getRandomNumber(uint max);
void shuffleArray(int32 *arr, int32 count);
+ void drawScaledFrame(const Graphics::Surface *frame, uint16 x, uint16 y);
// Energy
void setLastEnergyValue(const int32 value) { _savedEnergyValue = value; }
@@ -246,7 +247,6 @@ private:
void shellGameInput(const Input &input, const Hotspot *cursorSpot);
Common::RandomSource *_rnd;
void doSubChase();
- void drawScaledFrame(const Graphics::Surface *frame, uint16 x, uint16 y);
// Menu
GameMenu *_gameMenu;