ScummVM API documentation
stork.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_PREGOB_ONCEUPON_STORK_H
29#define GOB_PREGOB_ONCEUPON_STORK_H
30
31#include "common/system.h"
32
33#include "gob/aniobject.h"
34
35namespace Common {
36 class String;
37}
38
39namespace Gob {
40
41class GobEngine;
42
43class Surface;
44class ANIFile;
45
46namespace OnceUpon {
47
49class Stork : public ANIObject {
50public:
52 struct BundleDrop {
53 int16 anim;
54
55 int16 dropX;
56 int16 landY;
57
59 };
60
61 Stork(GobEngine *vm, const ANIFile &ani);
62 ~Stork() override;
63
65 bool hasBundleLanded() const;
66
68 void dropBundle(const BundleDrop &drop);
69
71 bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) override;
73 bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) override;
74
76 void advance() override;
77
78private:
79 enum State {
80 kStateFlyNearWithBundle = 0,
81 kStateFlyFarWithBundle ,
82 kStateFlyNearWithoutBundle ,
83 kStateFlyFarWithoutBundle
84 };
85
86
87 Surface *_frame;
88 ANIObject *_bundle;
89
90 State _state;
91
92 bool _shouldDrop;
93 BundleDrop _bundleDrop;
94
95
96 void setState(State state, uint16 anim);
97 void setState(State state, uint16 anim, int16 x);
98
99 void dropBundle(State state, uint16 anim);
100};
101
102} // End of namespace OnceUpon
103
104} // End of namespace Gob
105
106#endif // GOB_PREGOB_ONCEUPON_STORK_H
Definition: anifile.h:53
Definition: aniobject.h:42
Definition: gob.h:166
Definition: stork.h:49
bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) override
void dropBundle(const BundleDrop &drop)
bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom) override
bool hasBundleLanded() const
void advance() override
Definition: surface.h:106
Definition: algorithm.h:29
Definition: stork.h:52
int16 anim
Animation of the bundle floating down.
Definition: stork.h:53
int16 dropX
X position the stork drops the bundle.
Definition: stork.h:55
int16 landY
Y position the bundle lands.
Definition: stork.h:56
bool dropWhileFar
Does the stork drop the bundle while far instead of near?
Definition: stork.h:58