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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GOB_PREGOB_ONCEUPON_STORK_H 24 #define GOB_PREGOB_ONCEUPON_STORK_H 25 26 #include "common/system.h" 27 28 #include "gob/aniobject.h" 29 30 namespace Common { 31 class String; 32 } 33 34 namespace Gob { 35 36 class GobEngine; 37 38 class Surface; 39 class ANIFile; 40 41 namespace OnceUpon { 42 43 /** The stork in Baba Yaga / dragon in Abracadabra. */ 44 class Stork : public ANIObject { 45 public: 46 /** Information on how to drop the bundle. */ 47 struct BundleDrop { 48 int16 anim; ///< Animation of the bundle floating down 49 50 int16 dropX; ///< X position the stork drops the bundle 51 int16 landY; ///< Y position the bundle lands 52 53 bool dropWhileFar; ///< Does the stork drop the bundle while far instead of near? 54 }; 55 56 Stork(GobEngine *vm, const ANIFile &ani); 57 ~Stork(); 58 59 /** Has the bundle landed? */ 60 bool hasBundleLanded() const; 61 62 /** Drop the bundle. */ 63 void dropBundle(const BundleDrop &drop); 64 65 /** Draw the current frame onto the surface and return the affected rectangle. */ 66 bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); 67 /** Draw the current frame from the surface and return the affected rectangle. */ 68 bool clear(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom); 69 70 /** Advance the animation to the next frame. */ 71 void advance(); 72 73 private: 74 enum State { 75 kStateFlyNearWithBundle = 0, 76 kStateFlyFarWithBundle , 77 kStateFlyNearWithoutBundle , 78 kStateFlyFarWithoutBundle 79 }; 80 81 82 Surface *_frame; 83 ANIObject *_bundle; 84 85 State _state; 86 87 bool _shouldDrop; 88 BundleDrop _bundleDrop; 89 90 91 void setState(State state, uint16 anim); 92 void setState(State state, uint16 anim, int16 x); 93 94 void dropBundle(State state, uint16 anim); 95 }; 96 97 } // End of namespace OnceUpon 98 99 } // End of namespace Gob 100 101 #endif // GOB_PREGOB_ONCEUPON_STORK_H 102