diff options
author | Filippos Karapetis | 2014-10-15 11:33:14 +0300 |
---|---|---|
committer | Filippos Karapetis | 2014-10-15 11:33:14 +0300 |
commit | 673537bad93f0b440172a0cc263ebf19cc95ffc0 (patch) | |
tree | 75d1624e73008f3037cdd0d1d14d6cb041d61cf1 /engines/mads/nebular/menu_nebular.h | |
parent | d3cfa8cc03bf0d1f9c4927e76377acbaabd63bab (diff) | |
download | scummvm-rg350-673537bad93f0b440172a0cc263ebf19cc95ffc0.tar.gz scummvm-rg350-673537bad93f0b440172a0cc263ebf19cc95ffc0.tar.bz2 scummvm-rg350-673537bad93f0b440172a0cc263ebf19cc95ffc0.zip |
MADS: Move all the anim and text view code into a common class
The animation and text players are more or less common among all MADS
games
Diffstat (limited to 'engines/mads/nebular/menu_nebular.h')
-rw-r--r-- | engines/mads/nebular/menu_nebular.h | 190 |
1 files changed, 1 insertions, 189 deletions
diff --git a/engines/mads/nebular/menu_nebular.h b/engines/mads/nebular/menu_nebular.h index c05c87258e..29777a7a7c 100644 --- a/engines/mads/nebular/menu_nebular.h +++ b/engines/mads/nebular/menu_nebular.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/menu_views.h" #include "mads/msurface.h" #include "mads/nebular/dialogs_nebular.h" @@ -36,27 +37,6 @@ namespace Nebular { enum MADSGameAction { START_GAME, RESUME_GAME, SHOW_INTRO, CREDITS, QUOTES, EXIT }; -class MenuView: public FullScreenDialog { -protected: - bool _breakFlag; - bool _redrawFlag; - - virtual void doFrame() = 0; - - virtual void display(); - - /** - * Event handler - */ - virtual bool onEvent(Common::Event &event); -public: - MenuView(MADSEngine *vm); - - virtual ~MenuView() {} - - virtual void show(); -}; - class MainMenu: public MenuView { private: SpriteAsset *_menuItems[7]; @@ -148,174 +128,6 @@ public: void show(); }; -struct TextLine { - Common::Point _pos; - Common::String _line; - int _textDisplayIndex; -}; - -/** - * Scrolling text view - */ -class TextView : public MenuView { -private: - static char _resourceName[100]; - - bool _animating; - Common::Array<TextLine> _textLines; - Common::Point _pan; - int _panSpeed; - MSurface _spareScreens[4]; - int _scrollCount; - int _lineY; - uint32 _scrollTimeout; - int _panCountdown; - int _translationX; - Common::File _script; - char _currentLine[80]; - MSurface *_spareScreen; - Font *_font; -private: - /** - * Load the text resource - */ - void load(); - - /** - * Process the lines - */ - void processLines(); - - /** - * Process a command from the script file - */ - void processCommand(); - - /** - * Process text from the script file - */ - void processText(); - - /** - * Get a parameter from line - */ - int getParameter(const char **paramP); - - /** - * Called when the script is finished - */ - void scriptDone(); - - /** - * Reset the game palette - */ - void resetPalette(); -protected: - virtual void display(); - - virtual void doFrame(); -public: - /** - * Queue the given text resource for display - */ - static void execute(MADSEngine *vm, const Common::String &resName); - - TextView(MADSEngine *vm); - - virtual ~TextView(); -}; - -enum ResyncMode { NEVER, ALWAYS, BEGINNING }; - -struct ResourceEntry { - Common::String _resourceName; - int _fx; - bool _soundFlag; - bool _bgFlag; - bool _showWhiteBars; - - ResourceEntry() {} - ResourceEntry(const Common::String &resName, int fx, bool soundFlag, - bool bgFlag, bool showWhiteBars) { - _resourceName = resName; - _fx = fx; - _soundFlag = soundFlag; - _bgFlag = bgFlag; - _showWhiteBars = showWhiteBars; - } -}; - -struct ResIndexEntry { - int _id; - int _v; - Common::String _resourceName; - - ResIndexEntry() {} -}; - -/** -* Animation cutscene view -*/ -class AnimationView : public MenuView { -private: - static char _resourceName[100]; - - Common::File _script; - uint32 _previousUpdate; - Common::String _currentLine; - bool _soundDriverLoaded; - bool _resetPalette; - ResyncMode _resyncMode; - int _sfx; - bool _soundFlag; - bool _bgLoadFlag; - bool _showWhiteBars; - Common::Array<ResourceEntry> _resources; - Common::Array<ResIndexEntry> _resIndex; - int _v1; - int _v2; - int _resourceIndex; - SceneInfo *_sceneInfo; - Animation *_currentAnimation; - int _manualFrameNumber; - SpriteAsset *_manualSpriteSet; - int _manualStartFrame, _manualEndFrame; - int _manualFrame2; - int _animFrameNumber; - bool _nextCyclingActive; -private: - void checkResource(const Common::String &resourceName); - - int scanResourceIndex(const Common::String &resourceName); - - void load(); - - void processLines(); - - void processCommand(); - - int getParameter(); - - void scriptDone(); - - void loadNextResource(); -protected: - virtual void display(); - - virtual void doFrame(); - - virtual bool onEvent(Common::Event &event); -public: - /** - * Queue the given text resource for display - */ - static void execute(MADSEngine *vm, const Common::String &resName); - - AnimationView(MADSEngine *vm); - - virtual ~AnimationView(); -}; - } // End of namespace Nebular } // End of namespace MADS |