ScummVM API documentation
m_swap.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_SWAP_H
23#define QDENGINE_MINIGAMES_ADV_M_SWAP_H
24
25#include "qdengine/minigames/adv/MinigameInterface.h"
26
27namespace QDEngine {
28
29MinigameInterface *createMinigameSwap(MinigameManager *runtime);
30
31class Swap : public MinigameInterface {
32public:
33 Swap(MinigameManager *runtime);
34 ~Swap();
35
36 void quant(float dt);
37private:
38 int _gameSize = 0;
39 int _angles = 0;
40
41 float _rotateTimePeriod = 0.5f; // время поворота фишки
42 float _nextRotateTime = 0.f; // время следующего поворота
43
44 mgVect2f _size;
45
46 struct Node {
47 Node(int idx = -1) : home(idx), angle(0) {}
48 QDObject obj;
49 int angle;
50 int home;
51 };
53 Nodes _nodes;
54
55 // Индекс фрагмента на мыши
56 int _pickedItem = -1;
57 // активные фрагменты после обмена
58 int _last1 = 0, _last2 = 0;
59
60 Coords _positions;
61
62 const char *getStateName(int angle, bool selected) const;
63 // поменять местами, если было снятие или укладка на/с правильного места, то true
64 void swap(int item1, int item2, bool silent);
65 // повернуть фишку
66 void rotate(int item1, int item2, bool silent, bool avto = false);
67 // погасить выделенные
68 void deactivate();
69 // проверить нахождение фишки на своем месте
70 bool testPlace(int idx) const;
71 // поставить объект на свое место и включить нужное состояние
72 void put(int idx, bool hl);
73 // мировые координаты слота на поле
74 const mgVect3f &position(int num) const;
75
76 MinigameManager *_runtime;
77};
78
79} // namespace QDEngine
80
81#endif // QDENGINE_MINIGAMES_ADV_M_SWAP_H
Definition: MinigameInterface.h:27
Definition: RunTime.h:94
Definition: common.h:34
Definition: m_swap.h:31
Базовый класс для игровых ресурсов.
Definition: console.h:28