diff options
Diffstat (limited to 'engines/pegasus/neighborhood/neighborhood.h')
-rw-r--r-- | engines/pegasus/neighborhood/neighborhood.h | 186 |
1 files changed, 165 insertions, 21 deletions
diff --git a/engines/pegasus/neighborhood/neighborhood.h b/engines/pegasus/neighborhood/neighborhood.h index 5d3e75bf3a..b06fb7532a 100644 --- a/engines/pegasus/neighborhood/neighborhood.h +++ b/engines/pegasus/neighborhood/neighborhood.h @@ -36,6 +36,7 @@ #include "pegasus/notification.h" #include "pegasus/sound.h" #include "pegasus/timers.h" +#include "pegasus/transition.h" #include "pegasus/util.h" #include "pegasus/neighborhood/door.h" #include "pegasus/neighborhood/exit.h" @@ -64,6 +65,10 @@ const tNeighborhoodID kNoradDeltaID = 8; // to allow an easy transition out of Norad Alpha. const tNeighborhoodID kNoradSubChaseID = 1000; +const TimeScale kDefaultLoopFadeScale = kThirtyTicksPerSecond; +const TimeValue kDefaultLoopFadeOut = kHalfSecondPerThirtyTicks; +const TimeValue kDefaultLoopFadeIn = kHalfSecondPerThirtyTicks; + enum tQueueRequestType { kNavExtraRequest, kSpotSoundRequest, @@ -101,7 +106,7 @@ protected: typedef Common::Queue<tQueueRequest> NeighborhoodActionQueue; -class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler { +class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler, public Idler { friend class StriderCallBack; public: @@ -110,27 +115,83 @@ public: virtual void init(); void start(); + virtual void moveNavTo(const tCoordType, const tCoordType); + virtual void checkContinuePoint(const tRoomID, const tDirectionConstant) = 0; - void arriveAt(tRoomID room, tDirectionConstant direction); - - virtual void getExitEntry(const tRoomID room, const tDirectionConstant direction, ExitTable::Entry &entry); - virtual TimeValue getViewTime(const tRoomID room, const tDirectionConstant direction); - virtual void getDoorEntry(const tRoomID room, const tDirectionConstant direction, DoorTable::Entry &doorEntry); - virtual tDirectionConstant getTurnEntry(const tRoomID room, const tDirectionConstant direction, const tTurnDirection turn); - virtual void findSpotEntry(const tRoomID room, const tDirectionConstant direction, tSpotFlags flags, SpotTable::Entry &spotEntry); - virtual void getZoomEntry(const tHotSpotID id, ZoomTable::Entry &zoomEntry); - virtual void getHotspotEntry(const tHotSpotID id, HotspotInfoTable::Entry &hotspotEntry); - virtual void getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry); + virtual void activateHotspots(); + virtual void clickInHotspot(const Input &, const Hotspot *); tCanMoveForwardReason canMoveForward(ExitTable::Entry &entry); tCanTurnReason canTurn(tTurnDirection turn, tDirectionConstant &nextDir); tCanOpenDoorReason canOpenDoor(DoorTable::Entry &entry); + virtual void cantMoveThatWay(tCanMoveForwardReason); + virtual void cantTurnThatWay(tCanTurnReason) {} + virtual void cantOpenDoor(tCanOpenDoorReason); + virtual void arriveAt(tRoomID room, tDirectionConstant direction); + virtual void turnTo(const tDirectionConstant); + virtual void spotCompleted(); + virtual void doorOpened(); + virtual void closeDoorOffScreen(const tRoomID, const tDirectionConstant) {} + + virtual void moveForward(); + virtual void turn(const tTurnDirection); + virtual void turnLeft(); + virtual void turnRight(); + virtual void turnUp(); + virtual void turnDown(); + virtual void openDoor(); + virtual void zoomTo(const Hotspot *); + + virtual void updateViewFrame(); + void requestExtraSequence(const tExtraID, const tNotificationFlags, const tInputBits interruptionFilter); void requestSpotSound(const TimeValue, const TimeValue, const tInputBits interruptionFilter, const tNotificationFlags); + void playSpotSoundSync(const TimeValue in, const TimeValue out); void requestDelay(const TimeValue, const TimeScale, const tInputBits interruptionFilter, const tNotificationFlags); + Notification *getNeighborhoodNotification() { return &_neighborhoodNotification; } + + virtual void getExtraEntry(const uint32 id, ExtraTable::Entry &extraEntry); + virtual void startSpotLoop(TimeValue, TimeValue, tNotificationFlags = 0); virtual bool actionQueueEmpty() { return _actionQueue.empty(); } + virtual void showViewFrame(TimeValue); + virtual void findSpotEntry(const tRoomID room, const tDirectionConstant direction, tSpotFlags flags, SpotTable::Entry &spotEntry); + virtual void startExtraSequence(const tExtraID, const tNotificationFlags, const tInputBits interruptionFilter); + bool startExtraSequenceSync(const tExtraID, const tInputBits); + virtual void loopExtraSequence(const uint32, tNotificationFlags = 0); + int32 getLastExtra() const { return _lastExtra; } + virtual void scheduleNavCallBack(tNotificationFlags); + + Movie *getNavMovie() { return &_navMovie; } + bool navMoviePlaying(); + + void setCurrentAlternate(const tAlternateID alt) { _currentAlternate = alt; } + tAlternateID getCurrentAlternate() const { return _currentAlternate; } + + void setCurrentActivation(const tHotSpotActivationID a) { _currentActivation = a; } + tHotSpotActivationID getCurrentActivation() { return _currentActivation; } + + virtual void playDeathExtra(tExtraID, tDeathReason); + virtual void die(const tDeathReason); + + virtual void setSoundFXLevel(const uint16); + virtual void setAmbienceLevel(const uint16); + + void forceStridingStop(const tRoomID, const tDirectionConstant, const tAlternateID); + void restoreStriding(const tRoomID, const tDirectionConstant, const tAlternateID); + + HotspotInfoTable::Entry *findHotspotEntry(const tHotSpotID); + + Push *getTurnPush() { return &_turnPush; } + Picture *getTurnPushPicture() { return &_pushIn; } + + void hideNav(); + void showNav(); + + virtual void loadAmbientLoops() {} + + virtual void flushGameState() {} virtual Common::String getBriefingMovie(); virtual Common::String getEnvScanMovie(); @@ -149,29 +210,81 @@ public: virtual void shieldOn() {} virtual void shieldOff() {} - virtual void scheduleNavCallBack(tNotificationFlags); + virtual void loadLoopSound1(const Common::String &, const uint16 volume = 0x100, + const TimeValue fadeOut = kDefaultLoopFadeOut, const TimeValue fadeIn = kDefaultLoopFadeIn, + const TimeScale fadeScale = kDefaultLoopFadeScale); + virtual void loadLoopSound2(const Common::String &, const uint16 volume = 0x100, + const TimeValue fadeOut = kDefaultLoopFadeOut, const TimeValue fadeIn = kDefaultLoopFadeIn, + const TimeScale fadeScale = kDefaultLoopFadeScale); + + virtual void takeItemFromRoom(Item *); protected: PegasusEngine *_vm; Common::String _resName; + + virtual void loadSoundSpots(); + // Notification function. virtual void receiveNotification(Notification *, const tNotificationFlags); - virtual void createNeighborhoodSpots(); - virtual void loadSoundSpots(); + // Map info functions. + virtual void getExitEntry(const tRoomID room, const tDirectionConstant direction, ExitTable::Entry &entry); + virtual TimeValue getViewTime(const tRoomID room, const tDirectionConstant direction); + virtual void getDoorEntry(const tRoomID room, const tDirectionConstant direction, DoorTable::Entry &doorEntry); + virtual tDirectionConstant getTurnEntry(const tRoomID room, const tDirectionConstant direction, const tTurnDirection turn); + virtual void getZoomEntry(const tHotSpotID id, ZoomTable::Entry &zoomEntry); + virtual void getHotspotEntry(const tHotSpotID id, HotspotInfoTable::Entry &hotspotEntry); // Nav movie sequences. - virtual void checkStriding(); + virtual void startExitMovie(const ExitTable::Entry &); virtual void keepStriding(ExitTable::Entry &); virtual void stopStriding(); + virtual void checkStriding(); virtual bool stillMoveForward(); virtual void scheduleStridingCallBack(const TimeValue, tNotificationFlags flags); + virtual void startZoomMovie(const ZoomTable::Entry &); + virtual void startDoorOpenMovie(const TimeValue, const TimeValue); + virtual void startTurnPush(const tTurnDirection, const TimeValue, const tDirectionConstant); + virtual void playExtraMovie(const ExtraTable::Entry &, const tNotificationFlags, const tInputBits interruptionFilter); + + virtual void activateCurrentView(const tRoomID, const tDirectionConstant, tSpotFlags); + + virtual void activateOneHotspot(HotspotInfoTable::Entry &, Hotspot *); + + virtual void startSpotOnceOnly(TimeValue, TimeValue); + + virtual void startMovieSequence(const TimeValue, const TimeValue, tNotificationFlags, + bool loopSequence, const tInputBits interruptionFilter, const TimeValue strideStop = 0xffffffff); + + virtual void createNeighborhoodSpots(); + + void resetLastExtra() { _lastExtra = -1; } + + virtual void throwAwayInterface(); // Action queue stuff void popActionQueue(); void serviceActionQueue(); void requestAction(const tQueueRequestType, const tExtraID, const TimeValue, const TimeValue, const tInputBits, const tNotificationFlags); + virtual bool prepareExtraSync(const tExtraID); + virtual bool waitMovieFinish(Movie *, const tInputBits); + + virtual tInputBits getInputFilter(); + + // Misc. + virtual uint16 getStaticCompassAngle(const tRoomID, const tDirectionConstant dir); + virtual void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &); + virtual void getZoomCompassMove(const ZoomTable::Entry &, FaderMoveSpec&); + virtual void getExtraCompassMove(const ExtraTable::Entry &, FaderMoveSpec&); + + virtual void setUpAIRules(); + + virtual void newInteraction(const tInteractionID); + virtual void bumpIntoWall(); + virtual void zoomUpOrBump(); + // Navigation Data DoorTable _doorTable; ExitTable _exitTable; @@ -181,26 +294,57 @@ protected: TurnTable _turnTable; ViewTable _viewTable; ZoomTable _zoomTable; - virtual uint16 getStaticCompassAngle(const tRoomID, const tDirectionConstant dir); - virtual void getExitCompassMove(const ExitTable::Entry &, FaderMoveSpec &); + tAlternateID _currentAlternate; + tHotSpotActivationID _currentActivation; + + int32 _lastExtra; + tDeathReason _extraDeathReason; // Graphics Movie _navMovie; + Picture _pushIn; + Push _turnPush; // Callbacks Notification _neighborhoodNotification; NotificationCallBack _navMovieCallBack; StriderCallBack _stridingCallBack; + NotificationCallBack _turnPushCallBack; + NotificationCallBack _spotSoundCallBack; + NotificationCallBack _delayCallBack; - tAlternateID _currentAlternate; - + // Hotspots HotspotList _neighborhoodHotspots; - NeighborhoodActionQueue _actionQueue; - + // Sounds Sound _spotSounds; + // Action queue + NeighborhoodActionQueue _actionQueue; + TimeBase _delayTimer; + + // Interruptibility... tInputBits _interruptionFilter; + + // Nav hiding (for info support...) + bool _isRunning; + + // TODO + //GameInteraction *_currentInteraction; + bool _doneWithInteraction; + Movie _croppedMovie; + + Sound _soundLoop1; + Common::String _loop1SoundString; + SoundFader _loop1Fader; + + Sound _soundLoop2; + Common::String _loop2SoundString; + SoundFader _loop2Fader; + + // The event timer... + FuseFunction _eventTimer; + uint32 _timerEvent; }; extern Neighborhood *g_neighborhood; |