aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-12-12 15:27:48 -0500
committerMatthew Hoops2011-12-12 15:27:48 -0500
commit9c1fbbd1c2b63e4a610f39dac57366c227161908 (patch)
tree63b84301514841ae45088e80e804e674fde953b7
parent00279659b22cbd5db739d5351e83a9fc2a2ae408 (diff)
downloadscummvm-rg350-9c1fbbd1c2b63e4a610f39dac57366c227161908.tar.gz
scummvm-rg350-9c1fbbd1c2b63e4a610f39dac57366c227161908.tar.bz2
scummvm-rg350-9c1fbbd1c2b63e4a610f39dac57366c227161908.zip
PEGASUS: Implement shooting Sinclair
-rwxr-xr-xengines/pegasus/neighborhood/caldoria/caldoria.cpp40
-rwxr-xr-xengines/pegasus/neighborhood/caldoria/caldoria.h16
2 files changed, 52 insertions, 4 deletions
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
index 9e8717b317..3b6fe02da7 100755
--- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
@@ -157,7 +157,16 @@ void sinclairTimerExpiredFunction(FunctionPtr *, void *caldoria) {
((Caldoria *)caldoria)->sinclairTimerExpired();
}
-Caldoria::Caldoria(InputHandler* nextHandler, PegasusEngine *owner) : Neighborhood(nextHandler, owner, "Caldoria", kCaldoriaID) {
+SinclairCallBack::SinclairCallBack(Caldoria *caldoria) {
+ _caldoria = caldoria;
+}
+
+void SinclairCallBack::callBack() {
+ _caldoria->checkInterruptSinclair();
+}
+
+Caldoria::Caldoria(InputHandler* nextHandler, PegasusEngine *owner)
+ : Neighborhood(nextHandler, owner, "Caldoria", kCaldoriaID), _sinclairInterrupt(this) {
setIsItemTaken(kKeyCard);
setIsItemTaken(kOrangeJuiceGlassEmpty);
GameState.setTakenItemID(kOrangeJuiceGlassFull, GameState.isTakenItemID(kOrangeJuiceGlassEmpty));
@@ -166,6 +175,7 @@ Caldoria::Caldoria(InputHandler* nextHandler, PegasusEngine *owner) : Neighborho
}
Caldoria::~Caldoria() {
+ _sinclairInterrupt.releaseCallBack();
}
void Caldoria::init() {
@@ -174,6 +184,8 @@ void Caldoria::init() {
// We need this notification flag as well.
_neighborhoodNotification.notifyMe(this, kSinclairLoopDoneFlag, kSinclairLoopDoneFlag);
+ _sinclairInterrupt.initCallBack(&_navMovie, kCallBackAtTime);
+
forceStridingStop(kCaldoria55, kSouth, kAltCaldoriaSinclairDown);
forceStridingStop(kCaldoria50, kNorth, kAltCaldoriaSinclairDown);
}
@@ -1072,8 +1084,15 @@ void Caldoria::setUpSinclairLoops() {
_navMovie.start();
}
-void Caldoria::zoomToSinclair() {
- // TODO
+void Caldoria::zoomToSinclair() {
+ _utilityFuse.stopFuse();
+ _privateFlags.setFlag(kCaldoriaPrivateReadyToShootFlag, true);
+ setCurrentActivation(kActivateZoomedOnSinclair);
+
+ ExtraTable::Entry entry;
+ getExtraEntry(kCa53EastZoomToSinclair, entry);
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime1, _navMovie.getScale());
+ startExtraSequence(kCa53EastZoomToSinclair, kExtraCompletedFlag, kFilterAllInput);
}
void Caldoria::receiveNotification(Notification *notification, const tNotificationFlags flags) {
@@ -1794,7 +1813,20 @@ void Caldoria::checkInterruptSinclair() {
_neighborhoodNotification.setNotificationFlags(kExtraCompletedFlag, kExtraCompletedFlag);
g_AIArea->unlockAI();
} else {
- // TODO
+ uint32 currentTime = _navMovie.getTime();
+
+ ExtraTable::Entry entry;
+ getExtraEntry(kCa53EastZoomToSinclair, entry);
+
+ if (currentTime < entry.movieStart + kSinclairInterruptionTime2)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime2,
+ _navMovie.getScale());
+ else if (currentTime < entry.movieStart + kSinclairInterruptionTime3)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime3,
+ _navMovie.getScale());
+ else if (currentTime < entry.movieStart + kSinclairInterruptionTime4)
+ _sinclairInterrupt.scheduleCallBack(kTriggerTimeFwd, entry.movieStart + kSinclairInterruptionTime4,
+ _navMovie.getScale());
}
}
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.h b/engines/pegasus/neighborhood/caldoria/caldoria.h
index f2e3775168..538eaafc01 100755
--- a/engines/pegasus/neighborhood/caldoria/caldoria.h
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.h
@@ -386,7 +386,21 @@ const tDisplayElementID kCaldoriaBombTimerID = kCaldoriaBombGridID + 1;
const TimeValue kCaldoria4DBlankChoiceIn = 29730;
const TimeValue kCaldoria4DBlankChoiceOut = 33910;
+class Caldoria;
+
+class SinclairCallBack : public TimeBaseCallBack {
+public:
+ SinclairCallBack(Caldoria *);
+ ~SinclairCallBack() {}
+
+protected:
+ virtual void callBack();
+
+ Caldoria *_caldoria;
+};
+
class Caldoria : public Neighborhood {
+friend class SinclairCallBack;
friend void doorBombTimerExpiredFunction(FunctionPtr *, void *);
friend void sinclairTimerExpiredFunction(FunctionPtr *, void *);
@@ -500,6 +514,8 @@ protected:
Sprite *_gunSprite;
+ SinclairCallBack _sinclairInterrupt;
+
Common::String getSoundSpotsName();
Common::String getNavMovieName();
};