ScummVM API documentation
conversationtask.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include "mutationofjb/commands/talkcommand.h"
23 #include "mutationofjb/conversationlinelist.h"
24 #include "mutationofjb/gamedata.h"
25 #include "mutationofjb/tasks/task.h"
26 #include "mutationofjb/widgets/conversationwidget.h"
27 
28 namespace MutationOfJB {
29 
30 class SayTask;
31 class ScriptExecutionContext;
32 
34 public:
35  ConversationTask(uint8 sceneId, const ConversationInfo &convInfo, TalkCommand::Mode mode) : _sceneId(sceneId), _convInfo(convInfo), _mode(mode), _currentGroupIndex(0), _currentItem(nullptr), _substate(IDLE), _haveChoices(false), _innerExecCtx(nullptr) {}
36  ~ConversationTask() override {}
37 
38  void start() override;
39  void update() override;
40 
41  void onChoiceClicked(ConversationWidget *, int response, uint32 data) override;
42 private:
43  void showChoicesOrPick();
44  const ConversationInfo::ItemGroup &getCurrentGroup() const;
45  void finish();
46  void startExtra();
47  void gotoNextGroup();
48  void createSayTasks(const ConversationLineList::Line *line);
49  uint8 getSpeechColor(const ConversationLineList::Speech &speech);
50 
51  uint8 _sceneId;
52  const ConversationInfo &_convInfo;
53  TalkCommand::Mode _mode;
54  uint _currentGroupIndex;
55  const ConversationInfo::Item *_currentItem;
56  TaskPtr _sayTask;
57 
58  enum Substate {
59  IDLE,
60  SAYING_QUESTION,
61  SAYING_RESPONSE,
62  SAYING_NO_QUESTIONS,
63  RUNNING_EXTRA
64  };
65 
66  Substate _substate;
67  bool _haveChoices;
68  ScriptExecutionContext *_innerExecCtx;
69 };
70 
71 }
Definition: script.h:106
Definition: conversationwidget.h:38
Definition: conversationlinelist.h:49
Definition: gamedata.h:429
Definition: task.h:36
Definition: animationdecoder.h:36
Definition: conversationlinelist.h:33
Definition: conversationwidget.h:32
Definition: gamedata.h:428
Definition: conversationtask.h:33