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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef ULTIMA4_GAME_PERSON_H
24 #define ULTIMA4_GAME_PERSON_H
25 
26 #include "ultima/ultima4/game/creature.h"
27 #include "ultima/ultima4/core/types.h"
28 
29 namespace Ultima {
30 namespace Ultima4 {
31 
32 class Conversation;
33 class Dialogue;
34 class Response;
35 class ResponsePart;
36 
37 typedef enum {
38 	NPC_EMPTY,
39 	NPC_TALKER,
40 	NPC_TALKER_BEGGAR,
41 	NPC_TALKER_GUARD,
42 	NPC_TALKER_COMPANION,
43 	NPC_VENDOR_WEAPONS,
44 	NPC_VENDOR_ARMOR,
45 	NPC_VENDOR_FOOD,
46 	NPC_VENDOR_TAVERN,
47 	NPC_VENDOR_REAGENTS,
48 	NPC_VENDOR_HEALER,
49 	NPC_VENDOR_INN,
50 	NPC_VENDOR_GUILD,
51 	NPC_VENDOR_STABLE,
52 	NPC_LORD_BRITISH,
53 	NPC_HAWKWIND,
54 	NPC_MAX
55 } PersonNpcType;
56 
57 class Person : public Creature {
58 public:
59 	Person(MapTile tile);
60 	Person(const Person *p);
61 
62 	bool canConverse() const;
63 	bool isVendor() const;
64 	Common::String getName() const override;
65 	void goToStartLocation();
66 	void setDialogue(Dialogue *d);
getStart()67 	MapCoords &getStart() {
68 		return _start;
69 	}
getNpcType()70 	PersonNpcType getNpcType() const {
71 		return _npcType;
72 	}
73 	void setNpcType(PersonNpcType t);
74 
75 	Common::List<Common::String> getConversationText(Conversation *cnv, const char *inquiry);
76 
77 	/**
78 	 * Get the prompt shown after each reply.
79 	 */
80 	Common::String getPrompt(Conversation *cnv);
81 
82 	/**
83 	 * Returns the valid keyboard choices for a given conversation.
84 	 */
85 	const char *getChoices(Conversation *cnv);
86 
87 	Common::String getIntro(Conversation *cnv);
88 	Common::String processResponse(Conversation *cnv, Response *response);
89 	void runCommand(Conversation *cnv, const ResponsePart &command);
90 	Common::String getResponse(Conversation *cnv, const char *inquiry);
91 	Common::String talkerGetQuestionResponse(Conversation *cnv, const char *inquiry);
92 	Common::String beggarGetQuantityResponse(Conversation *cnv, const char *response);
93 	Common::String lordBritishGetQuestionResponse(Conversation *cnv, const char *answer);
94 	Common::String getQuestion(Conversation *cnv);
95 
96 private:
97 	Dialogue *_dialogue;
98 	MapCoords _start;
99 	PersonNpcType _npcType;
100 };
101 
102 bool isPerson(Object *punknown);
103 
104 Common::List<Common::String> replySplit(const Common::String &text);
105 int linecount(const Common::String &s, int columnmax);
106 
107 } // End of namespace Ultima4
108 } // End of namespace Ultima
109 
110 #endif
111