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 BLADERUNNER_ACTOR_CLUES_H
24 #define BLADERUNNER_ACTOR_CLUES_H
25 
26 #include "common/array.h"
27 
28 namespace BladeRunner {
29 
30 class BladeRunnerEngine;
31 class SaveFileReadStream;
32 class SaveFileWriteStream;
33 
34 class ActorClues {
35 	// _vm->_gameInfo->getClueCount()
36 	static const int kClueCount = 288;
37 
38 	struct Clue {
39 		int clueId;
40 		int weight;
41 		int fromActorId;
42 		int field3; // unused (but stored/restored)
43 		int field4; // Used in Restored Content. Original: unused (but stored/restored)
44 		int field5; // unused (but stored/restored)
45 		int field6; // unused (but stored/restored)
46 		int field7; // unused (but stored/restored)
47 		int field8; // unused (but stored/restored)
48 		byte flags; // bit 0 (acquired), bit 1 (unknown), bit 2 (viewed), bit 3 (private)
49 	};
50 
51 	BladeRunnerEngine *_vm;
52 
53 	int                 _count;
54 	int                 _maxCount;
55 	Common::Array<Clue> _clues;
56 
57 public:
58 	struct CluesUS {
59 		int clueId;
60 		int modifier;
61 	};
62 
63 public:
64 	ActorClues(BladeRunnerEngine *_vm, int cluesLimit);
65 
66 	void add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId);
67 	bool exists(int clueId) const;
68 
69 	void acquire(int clueId, bool flag2, int fromActorId);
70 	void lose(int clueId);
71 	bool isAcquired(int clueId) const;
72 	int getWeight(int clueId) const;
73 
74 	int getModifier(int actorId, int otherActorId, int clueId);
75 
76 	void acquireCluesByRelations(int actorId, int otherActorId);
77 	int findAcquirableCluesFromActor(int actorId, int targetActorId, CluesUS *list, int size);
78 
79 	int getFromActorId(int clueId) const;
80 
81 	bool isFlag2(int clueId) const;
82 
83 	bool isViewed(int clueId) const;
84 	void setViewed(int clueId, bool viewed);
85 
86 	bool isPrivate(int clueId) const;
87 	void setPrivate(int clueId, bool value);
88 
89 	// Restored Content method - Checks whether a clue, that McCoy has, was shared with Mainframe
90 	bool isSharedWithMainframe(int clueId) const;
91 	// Restored Content method - Marks a clue, that McCoy has, as shared with Mainframe
92 	void setSharedWithMainframe(int clueId, bool value);
93 
94 	int getCount() const;
95 	int getClueIdByIndex(int index) const;
96 
97 	void removeAll();
98 
99 	void save(SaveFileWriteStream &f);
100 	void load(SaveFileReadStream &f);
101 
102 private:
103 	int findClueIndex(int clueId) const;
104 	void remove(int clueIndex);
105 };
106 
107 } // End of namespace BladeRunner
108 
109 #endif
110