ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

dialogplayer.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_SERVICES_DIALOG_PLAYER_H
00024 #define STARK_SERVICES_DIALOG_PLAYER_H
00025 
00026 #include "common/array.h"
00027 
00028 #include "engines/stark/resources/dialog.h"
00029 
00030 namespace Stark {
00031 
00032 namespace Resources {
00033 class Speech;
00034 }
00035 
00042 class DialogPlayer {
00043 public:
00044     DialogPlayer();
00045     virtual ~DialogPlayer();
00046 
00047     enum OptionType {
00048         kOptionTypeAsk = 0
00049     };
00050 
00051     struct Option {
00052         uint32 _type;
00053         Common::String _caption;
00054         Resources::Dialog::Topic *_topic;
00055         int32 _replyIndex;
00056     };
00057 
00059     void run(Resources::Dialog *dialog);
00060 
00062     void playSingle(Resources::Speech *speech);
00063 
00065     bool isRunning() const;
00066 
00068     void update();
00069 
00071     void selectOption(uint32 index);
00072 
00074     bool isSpeechReady() const;
00075     bool isSpeechReady(Resources::Speech *speech) const;
00076 
00078     Resources::Speech *acquireReadySpeech();
00079 
00081     bool areOptionsAvailable() const;
00082 
00084     Common::Array<DialogPlayer::Option> listOptions() const;
00085 
00087     void resume(Resources::Dialog *dialog);
00088 
00090     void reset();
00091 
00092 protected:
00094     void buildOptions();
00095 
00097     void removeLastOnlyOption();
00098 
00100     void onReplyEnd();
00101 
00102     void saveToInterruptionSlot();
00103     void restoreFromInterruptionSlot();
00104 
00105     Resources::Dialog *_currentDialog;
00106     Resources::Dialog::Reply *_currentReply;
00107 
00108     Resources::Dialog *_interruptedDialog;
00109     Resources::Dialog::Reply *_interruptedReply;
00110 
00111     Resources::Speech *_singleSpeech;
00112 
00113     bool _speechReady;
00114     bool _optionsAvailable;
00115     Common::Array<Option> _options;
00116 };
00117 
00118 } // End of namespace Stark
00119 
00120 #endif // STARK_SERVICES_DIALOG_PLAYER_H


Generated on Sat Oct 19 2019 05:01:11 for ResidualVM by doxygen 1.7.1
curved edge   curved edge