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

engines/stark/resources/dialog.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_RESOURCES_DIALOG_H
00024 #define STARK_RESOURCES_DIALOG_H
00025 
00026 #include "common/str.h"
00027 
00028 #include "engines/stark/resources/object.h"
00029 #include "engines/stark/resourcereference.h"
00030 
00031 namespace Stark {
00032 
00033 namespace Formats {
00034 class XRCReadStream;
00035 }
00036 
00037 namespace Resources {
00038 
00039 class Speech;
00040 class Script;
00041 
00052 class Dialog : public Object {
00053 public:
00054     static const Type::ResourceType TYPE = Type::kDialog;
00055 
00056     Dialog(Object *parent, byte subType, uint16 index, const Common::String &name);
00057     virtual ~Dialog();
00058 
00062     class Reply {
00063     public:
00064         Reply();
00065 
00066         enum ConditionType {
00067             kConditionTypeAlways              = 0,
00068             kConditionTypeNoOtherOptions      = 1,
00069             kConditionTypeHasItem             = 3,
00070             kConditionTypeCheckValue4         = 4,
00071             kConditionTypeCheckValue5         = 5,
00072             kConditionTypeRunScriptCheckValue = 6
00073         };
00074 
00076         void start();
00077 
00079         void goToNextLine();
00080 
00082         Speech *getCurrentSpeech();
00083 
00085         bool checkCondition() const;
00086 
00088         bool isLastOnly() const;
00089 
00090     private:
00091         // Static data
00092         Common::Array<ResourceReference> _lines;
00093         uint32 _conditionType;
00094         ResourceReference _conditionReference;
00095         ResourceReference _conditionScriptReference;
00096         uint32 _conditionReversed;
00097         uint32 _field_88;
00098         uint32 _minChapter;
00099         uint32 _maxChapter;
00100         uint32 _noCaption;
00101         int32 _nextDialogIndex;
00102         ResourceReference _nextScriptReference;
00103 
00104         // State
00105         int32 _nextSpeechIndex;
00106 
00107         friend class Dialog;
00108     };
00109 
00113     class Topic {
00114     public:
00115         Topic();
00116 
00118         int32 getNextReplyIndex() const;
00119 
00121         Common::String getCaption() const;
00122 
00124         Reply *startReply(uint32 index);
00125 
00127         Reply *getReply(uint32 index);
00128 
00129     private:
00130         Common::Array<Reply> _replies;
00131 
00132         bool _removeOnceDepleted;
00133         int32 _currentReplyIndex;
00134 
00135         friend class Dialog;
00136     };
00137 
00138     typedef Common::Array<Topic *> TopicArray;
00139 
00140     // Resource API
00141     void readData(Formats::XRCReadStream *stream) override;
00142     void saveLoad(ResourceSerializer *serializer) override;
00143 
00145     TopicArray listAvailableTopics();
00146 
00148     Dialog *getNextDialog(Reply *reply);
00149 
00151     Script *getNextScript(Reply *reply);
00152 
00154     Common::String getDiaryTitle() const;
00155 
00157     int32 getCharacter() const;
00158 
00159 protected:
00160     void printData() override;
00161 
00162     Common::Array<Topic> _topics;
00163     uint32 _character;
00164     uint32 _hasAskAbout;
00165 };
00166 
00167 } // End of namespace Resources
00168 } // End of namespace Stark
00169 
00170 #endif // STARK_RESOURCES_DIALOG_H


Generated on Sat May 18 2019 05:00:59 for ResidualVM by doxygen 1.7.1
curved edge   curved edge