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 MinigameInterface *createMinigamePuzzle(MinigameManager *runtime);
31 
32 class Puzzle : public MinigameInterface {
33  struct Node {
34  QDObject obj;
35  int angle;
36  int pos;
37 
38  bool inStack() const {
39  return pos < -1;
40  }
41  bool isFree() const {
42  return pos == -1;
43  }
44 
45  Node() : angle(1), pos(-1) {}
46  };
47 
48  typedef Std::vector<Node> Nodes;
49 
50 public:
51  Puzzle(MinigameManager *runtime);
52  ~Puzzle();
53 
54  void quant(float dt);
55 
56 private:
57  int _gameSize = 0;
58  int _angles = 0;
59 
60  int _globalAngle = 0;
61  float _rotateTimePeriod = 0.f;
62  float _nextRotateTime = 0.f;
63 
64  bool _singleSize = false;
65  mgVect2f _size;
66  float _depth = 0.f;
67 
68  Nodes _nodes;
70  int _prevPlace = -1;
72  int _pickedItem = -1;
73 
74  int _inField = 0; // количество фрагментов на поле
75 
76  float _nextObjTime = 0.f;
77  int _mouseObjPose = -1; // индекс положения фрагмента на мыши в стеке
78 
79  QDObject _stackBottom;
80  int _stackSize = 0;
81  mgVect2f _stackPlaceSize;
82 
83  Indexes _stack;
84  Indexes _field;
85 
86  FlyQDObjects _flyObjs;
88  float _flySpeed = 0.f;
90  float _returnSpeed = -1.f;
91 
92  Coords _positions;
93 
94  const char *getStateName(int angle, bool selected, bool small) const;
96  void rotate(int hovItem);
98  bool testPlace(int idx) const;
100  bool isOnMouse(const Node& node) const;
102  bool isFlying(int idx) const;
104  int stidx(int idx) const;
106  void put(int where, int what, float flowSpeed = -1.f);
108  void putOnStack(int what, float speed);
110  void returnToStack();
112  const mgVect3f &position(int num) const;
114  mgVect3f stackPosition(int N) const;
115 
116  MinigameManager *_runtime;
117 };
118 
119 } // namespace QDEngine
120 
121 #endif // QDENGINE_MINIGAMES_ADV_M_PUZZLE_H
Definition: common.h:34
Definition: MinigameInterface.h:27
Definition: RunTime.h:94
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: m_puzzle.h:32