ScummVM API documentation
flight.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 #ifndef SCUMM_INSANE_MORTIMER_FLIGHT_H
22 #define SCUMM_INSANE_MORTIMER_FLIGHT_H
23 
24 #include "scumm/insane/mortimer/movie.h"
25 
26 namespace Scumm {
27 
29 public:
30  enum { kWidth = 384, kHeight = 288 };
31  enum Weapon { kRevitascope, kSlimeGun };
32  enum ShotResult { kMiss, kAnimalRescued, kHornetHit, kShellRestored };
33  struct Target {
34  uint16 id, toggle, remapToggle;
35  uint rescuedAt;
36  Common::Rect rect;
37  Weapon hitWeapon;
38  bool active, hit;
39  };
40 
41  explicit MortimerFlight(bool isDemo = true, bool keepProgress = false);
42  bool load(Common::SeekableReadStream &stream, bool interactive = true, bool continuation = false);
43  void clearProgress();
44  void clearHostiles();
45  void reset() override;
46  bool advance(bool renderFrame = true) override;
47  ShotResult shoot(const Common::Point &point);
48  bool hitsObstacle(const Common::Point &point) const;
49 
50  uint rescuedCount() const { return _rescuedCount; }
51  uint rescuedSpecies() const { return _rescuedSpecies; }
52  Weapon weapon() const { return _weapon; }
53  void resetWeapon() { _weapon = kRevitascope; }
54  void setWeapon(Weapon weapon) { _weapon = weapon; }
55  const Common::String &nextFlight() const { return _nextFlight; }
56  const Common::Array<Target> &targets() const { return _targets; }
57  bool interactive() const { return _interactive; }
58  void setSteering(const Common::Point &point) { _steering = point; }
59  void setCollisionRadius(uint radius) { _collisionRadius = radius; }
60 
61 protected:
62  void handleAction(const byte *data, uint32 size) override;
63 
64 private:
65  struct Obstacle {
66  Common::Point corners[4];
67  bool outside;
68  };
69 
70  int objectScale(byte codec) const override;
71  Target *findTarget(uint16 id);
72  bool targetHit(uint16 id) const;
73  void hitTarget(uint16 id);
74  bool targetsRemain(const Common::String &list) const;
75 
76  Common::Array<Target> _targets;
77  Common::Array<Obstacle> _obstacles;
78  Common::String _nextFlight;
79  const bool _isDemo, _keepProgress;
80  bool _hitTargets[1400];
81  bool _initialInteractive, _interactive, _inBranch, _ignoreCollisions;
82  Common::Point _steering;
83  Weapon _weapon;
84  uint _rescuedCount, _rescuedSpecies, _collisionRadius;
85 };
86 
87 } // End of namespace Scumm
88 
89 #endif
Definition: str.h:59
Definition: flight.h:28
Definition: array.h:52
Definition: movie.h:144
Definition: rect.h:536
Definition: stream.h:745
Definition: rect.h:144
Definition: flight.h:33
Definition: actor.h:30