22 #ifndef ASYLUM_PUZZLES_PIPES_H 23 #define ASYLUM_PUZZLES_PIPES_H 25 #include "common/list.h" 26 #include "common/hashmap.h" 27 #include "common/array.h" 28 #include "common/random.h" 29 #include "common/str.h" 31 #include "asylum/puzzles/puzzle.h" 38 static const uint32 connectorsCount = 21, peepholesCount = 37;
60 kConnectorTypeI = kBinNum0101,
61 kConnectorTypeL = kBinNum0110,
62 kConnectorTypeT = kBinNum0111
66 kDirectionNowhere = kBinNum0000,
67 kDirectionNh = kBinNum0001,
68 kDirectionEt = kBinNum0010,
69 kDirectionSh = kBinNum0100,
70 kDirectionWt = kBinNum1000
78 static bool marks[peepholesCount];
79 uint32 _flowValues[4];
81 uint32 getId() {
return _id; }
82 void setId(uint32
id) { _id = id; }
83 uint32 getLevel() {
return (_flowValues[0] > 0) + (_flowValues[1] > 0) + (_flowValues[2] > 0) + (_flowValues[3] > 0); }
84 uint32 getLevel1() {
return _flowValues[0] + _flowValues[1] + _flowValues[2] + _flowValues[3]; }
85 bool isConnected() {
return isConnected(0) || isConnected(1) || isConnected(2) || isConnected(3); }
87 void connect(
Connector *connector) { _connectors.push_back(connector); }
88 void disconnect(
Connector *connector) { _connectors.remove(connector); }
89 void startUpWater(
bool flag =
false);
95 bool isConnected(uint32 val) {
return _flowValues[val]; }
103 uint32 getId() {
return _id; }
104 void setId(uint32
id) { _id = id; }
105 void setPos(uint32 *pos) { _position = pos; }
106 BinNum getState() {
return _state; }
107 ConnectorType getType() {
return _type; }
111 void turn(
bool updpos =
true);
122 Direction _nextConnectorPosition;
128 bool isReadyForConnection() {
return _state & _nextConnectorPosition; }
130 friend void Peephole::startUpWater(
bool);
138 bool isAlive()
const {
return _isAlive; }
139 bool isActive()
const {
return _delta !=
Common::Point(0, 0); }
142 Direction getDirection()
const {
return _direction; }
146 void smash() { _isAlive =
false; }
148 static const uint32 minStepsNumber = 20, maxStepsNumber = 200;
154 Direction _direction;
158 void randomize(Direction excluded = kDirectionNowhere);
170 int32 _previousMusicVolume;
172 uint32 _frameIndex, _frameIndexLever;
174 float _levelValues[4], _previousLevels[4];
178 uint32 _positions[connectorsCount];
179 Peephole _peepholes[peepholesCount];
182 uint32 *_frameIndexSpider;
195 void initResources();
201 void checkConnections();
206 #endif // ASYLUM_PUZZLES_PIPES_H
bool contains(int16 x, int16 y) const
Definition: rect.h:210
int16 right
Definition: rect.h:146
Definition: serializer.h:79
Definition: eventhandler.h:43
int16 left
Definition: rect.h:145
Out move(In first, In last, Out dst)
Definition: algorithm.h:109