ScummVM API documentation
pattable.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 STARK_RESOURCES_PAT_TABLE_H
23 #define STARK_RESOURCES_PAT_TABLE_H
24 
25 #include "common/str.h"
26 #include "common/hashmap.h"
27 
28 #include "engines/stark/resources/object.h"
29 
30 namespace Stark {
31 
32 namespace Formats {
33 class XRCReadStream;
34 }
35 
36 namespace Resources {
37 
38 class Script;
39 class String;
40 class ItemTemplate;
41 
42 typedef Common::Array<uint32> ActionArray;
43 
44 class PATTable : public Object {
45 public:
46  static const Type::ResourceType TYPE = Type::kPATTable;
47 
48  enum ActionType {
49  kActionUse = 1,
50  kActionLook = 2,
51  kActionTalk = 3,
52  kActionExit = 7
53  };
54 
55  PATTable(Object *parent, byte subType, uint16 index, const Common::String &name);
56  virtual ~PATTable();
57 
58  // Resource API
59  void readData(Formats::XRCReadStream *stream) override;
60  void onAllLoaded() override;
61  void onEnterLocation() override;
62  void saveLoad(ResourceSerializer *serializer) override;
63 
64  ActionArray listPossibleActions() const;
65 
66  bool runScriptForAction(uint32 action);
67 
68  bool canPerformAction(uint32 action) const;
69 
71  int32 getDefaultAction() const;
72 
74  void setTooltip(String *string);
75 
76 protected:
77  struct Entry {
78  uint32 _actionType;
79  int32 _scriptIndex;
80  Script *_script;
81  };
82 
84 
85  void addOwnEntriesToItemEntries();
86  Common::Array<Entry> listItemEntries() const;
87  ItemTemplate *findItemTemplate();
88 
89 
90  void printData() override;
91 
92  Common::Array<Entry> _ownEntries;
93  EntryMap _itemEntries;
94  int32 _defaultAction;
95  int32 _tooltipOverrideIndex;
96 };
97 
98 } // End of namespace Resources
99 } // End of namespace Stark
100 
101 #endif // STARK_RESOURCES_PAT_TABLE_H
Definition: str.h:59
Definition: console.h:27
Definition: object.h:143
Definition: item.h:214
Definition: string.h:43
Definition: pattable.h:77
Definition: xrc.h:45
Definition: pattable.h:44
Definition: stateprovider.h:51
Definition: script.h:45