ScummVM API documentation
submarine.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_MINIGAMES_GEISHA_SUBMARINE_H
29#define GOB_MINIGAMES_GEISHA_SUBMARINE_H
30
31#include "gob/aniobject.h"
32
33namespace Gob {
34
35namespace Geisha {
36
38class Submarine : public ANIObject {
39public:
40 enum Direction {
41 kDirectionNone,
42 kDirectionN,
43 kDirectionNE,
44 kDirectionE,
45 kDirectionSE,
46 kDirectionS,
47 kDirectionSW,
48 kDirectionW,
49 kDirectionNW
50 };
51
52 Submarine(const ANIFile &ani);
53 ~Submarine() override;
54
55 Direction getDirection() const;
56
58 void turn(Direction to);
59
61 void shoot();
62
64 void die();
65
67 void leave();
68
70 void advance() override;
71
73 bool canMove() const;
74
76 bool isDead() const;
77
79 bool isShooting() const;
80
82 bool hasExited() const;
83
84private:
85 enum State {
86 kStateNone = 0,
87 kStateMove,
88 kStateShoot,
89 kStateExit,
90 kStateExited,
91 kStateDie,
92 kStateDead
93 };
94
95 State _state;
96 Direction _direction;
97
99 uint16 directionToMove(Direction direction) const;
101 uint16 directionToShoot(Direction direction) const;
103 uint16 directionToExplode(Direction direction) const;
104
105 void move();
106};
107
108} // End of namespace Geisha
109
110} // End of namespace Gob
111
112#endif // GOB_MINIGAMES_GEISHA_SUBMARINE_H
Definition: anifile.h:53
Definition: aniobject.h:42
Definition: submarine.h:38
bool isShooting() const
void turn(Direction to)
void advance() override
bool hasExited() const