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 
35 namespace Common {
36  class String;
37 }
38 
39 namespace Gob {
40 
41 class GobEngine;
42 
43 class Surface;
44 class ANIFile;
45 
46 namespace OnceUpon {
47 
49 class Stork : public ANIObject {
50 public:
52  struct BundleDrop {
53  int16 anim;
54 
55  int16 dropX;
56  int16 landY;
57 
58  bool dropWhileFar;
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 
78 private:
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
int16 dropX
X position the stork drops the bundle.
Definition: stork.h:55
Definition: gob.h:163
Definition: aniobject.h:42
Definition: stork.h:52
int16 anim
Animation of the bundle floating down.
Definition: stork.h:53
Definition: anifile.h:40
Definition: stork.h:49
Definition: algorithm.h:29
Definition: surface.h:100
int16 landY
Y position the bundle lands.
Definition: stork.h:56
Definition: anifile.h:53
bool dropWhileFar
Does the stork drop the bundle while far instead of near?
Definition: stork.h:58