ScummVM API documentation
m_puzzle.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 QDENGINE_MINIGAMES_ADV_M_PUZZLE_H
23 #define QDENGINE_MINIGAMES_ADV_M_PUZZLE_H
24 
25 #include "qdengine/minigames/adv/MinigameInterface.h"
26 #include "qdengine/minigames/adv/FlyObject.h"
27 
28 namespace QDEngine {
29 
30 class Puzzle : public MinigameInterface {
31  struct Node {
32  QDObject obj;
33  int angle;
34  int pos;
35 
36  bool inStack() const {
37  return pos < -1;
38  }
39  bool isFree() const {
40  return pos == -1;
41  }
42 
43  Node() : angle(1), pos(-1) {}
44  };
45 
46  typedef vector<Node> Nodes;
47 
48 public:
49  Puzzle();
50  ~Puzzle();
51 
52  void quant(float dt);
53 
54 private:
55  int gameSize_;
56  int angles_;
57 
58  int globalAngle_;
59  float rotateTimePeriod_;
60  float nextRotateTime_;
61 
62  bool singleSize_;
63  mgVect2f size_;
64  float depth_;
65 
66  Nodes nodes_;
68  int prevPlace_;
70  int pickedItem_;
71 
72  int inField_;
73 
74  float nextObjTime_;
75  int mouseObjPose_;
76 
77  QDObject stackBottom_;
78  int stackSize_;
79  mgVect2f stackPlaceSize_;
80 
81  Indexes stack_;
82  Indexes field_;
83 
84  FlyQDObjects flyObjs_;
86  float flySpeed_;
88  float returnSpeed_;
89 
90  Coords positions_;
91 
92  const char *getStateName(int angle, bool selected, bool small) const;
94  void rotate(int hovItem);
96  bool testPlace(int idx) const;
98  bool isOnMouse(const Node& node) const;
100  bool isFlying(int idx) const;
102  int stidx(int idx) const;
104  void put(int where, int what, float flowSpeed = -1.f);
106  void putOnStack(int what, float speed);
108  void returnToStack();
110  const mgVect3f &position(int num) const;
112  mgVect3f stackPosition(int N) const;
113 };
114 
115 } // namespace QDEngine
116 
117 #endif // QDENGINE_MINIGAMES_ADV_M_PUZZLE_H
Definition: common.h:34
Definition: MinigameInterface.h:27
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: m_puzzle.h:30