ScummVM API documentation
dialogue_handler.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 #ifndef HARVESTER_NPC_DIALOGUE_HANDLER_H
23 #define HARVESTER_NPC_DIALOGUE_HANDLER_H
24 
25 #include "common/error.h"
26 #include "common/serializer.h"
27 #include "common/str.h"
28 
29 namespace Harvester {
30 
31 inline void syncDialogueBool(Common::Serializer &s, bool &value,
32  Common::Serializer::Version minVersion = 0,
33  Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion) {
34  if (s.getVersion() < minVersion || s.getVersion() > maxVersion)
35  return;
36  byte serialized = value ? 1 : 0;
37  s.syncAsByte(serialized);
38  if (s.isLoading())
39  value = serialized != 0;
40 }
41 
42 inline void syncDialogueInt(Common::Serializer &s, int &value,
43  Common::Serializer::Version minVersion = 0,
44  Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion) {
45  s.syncAsSint32LE(value, minVersion, maxVersion);
46 }
47 
48 inline void syncDialogueString(Common::Serializer &s, Common::String &value,
49  Common::Serializer::Version minVersion = 0,
50  Common::Serializer::Version maxVersion = Common::Serializer::kLastVersion) {
51  s.syncString(value, minVersion, maxVersion);
52 }
53 
54 class DialogueRuntime;
55 
57  bool boyleGascanApplicationState = false;
58  bool dialogueStateD2e98 = false;
59  bool dialogueStateD2eb0 = false;
60  bool dialogueStateD2eb8 = false;
61  bool dialogueStateD2ebc = false;
62  bool dialogueStateD2ec0 = false;
63  bool dialogueStateD2ec8 = false;
64  bool dialogueStateD2eec = false;
65  bool dialogueStateD2ed0 = false;
66  bool dialogueStateD2ef4 = false;
67  bool dialogueStateD2f04 = false;
68  bool dialogueStateD2ea4 = false;
69  bool dialogueStateD2ea8 = false;
70  bool dialogueStateD2f00 = false;
71  bool karinKidnapedDialogueState = false;
72  bool discussedLodgeTopic = false;
73  bool dialogueStateD2f08 = false;
74  bool waspWomanDialogueState = false;
75  bool momGoodCauseDay5State = false;
76  bool moynahanKarinKidnapedDiscussionState = false;
77  bool dwayneWhaleyDisciplineFollowupState = false;
78  bool dwayneDiscussedBoylesButton = false;
79  bool dwayneCompletedKarinAliveFollowup = false;
80  bool discussedMrPottsTuesdayNightAlibi = false;
81  bool discussedMrsPottsTuesdayNightAlibi = false;
82  bool confrontedMrPottsAboutSpyhole = false;
83  int serializedTalkStateFlagD2cd8 = 1;
84  int dwaynePendingKarinAliveFollowupState = 0;
85  int dialogueStateD2eac = 0;
86  int dialogueStateD2eb4 = 0;
87  int discussedNoteCheckbookEvidence = 0;
88  int discussedTvDeedEvidence = 0;
89  int discussedLedgerEvidence = 0;
90  int discussedCasketPhotoEvidence = 0;
91  int discussedWhaleyHerrillPhoto = 0;
92  int discussedKarinPurse = 0;
93  int momFatherTopicState = 0;
94  int dadMeatPermissionState = 0;
95  int sergeantCompletedFirstTaskState = 0;
96  int dialogueStateD2f30 = 0;
97 };
98 
100 public:
101  virtual ~NpcDialogueHandler() {}
102 
103  virtual bool matchesNpc(const Common::String &npcName) const = 0;
104  virtual void resetState() {}
105  virtual void syncState(Common::Serializer &) {}
106  virtual void migrateSharedState(DialogueSharedState &) {}
107  virtual Common::Error handleDialogue(DialogueRuntime &runtime,
108  const Common::String &usedItemName, DialogueSharedState &sharedState) = 0;
109 };
110 
111 } // End of namespace Harvester
112 
113 #endif // HARVESTER_NPC_DIALOGUE_HANDLER_H
Definition: str.h:59
Definition: art.h:31
Definition: error.h:81
Definition: dialogue_handler.h:99
Definition: dialogue_handler.h:56
Definition: serializer.h:80
void syncString(String &str, Version minVersion=0, Version maxVersion=kLastVersion)
Definition: serializer.h:249
Definition: dialogue_runtime.h:57
Version getVersion() const
Definition: serializer.h:173