ScummVM API documentation
monster.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  * Copyright 2020 Google
21  *
22  */
23 namespace Hadesch {
24 
25 enum {
26  // Splits of 15269 as we don't support intermediate anim callbacks
27  kCyclopsShootingEyeOpenMidAnim = 1015001,
28  kCyclopsShootingEyeClosedMidAnim = 1015002,
29  kHitReceived = 1015003
30 };
31 
32 
33 enum Monster {
34  kCyclops = 1,
35  kTyphoon = 2,
36  kIllusion = 3
37 };
38 
40  Common::Point centerPos;
41  int scale;
42 };
43 
45 public:
46  Projectile(int id, int level, Monster monster, int startScale, Common::Point startPoint, int xmomentum);
47  ~Projectile();
48 
49  void handleEvent(int ev);
50  void stop();
51  void makeFlightParams(int xmomentum);
52  FlightPosition getFlightPosition(double t);
53  void handleAbsoluteClick(Common::SharedPtr <Projectile> backRef, Common::Point p);
54 
55  // Event 15051
56  bool tick(Common::SharedPtr <Projectile> backRef);
57 
58 private:
59  int getProjectileFlightLength(int level);
60  int getProjectileHitChance();
61 
62  int _level;
63  bool _isMiss;
64  int _flightCounterMs;
65  int _flightStart;
66  int _projectileId;
67  int _pending;
68  bool _isFlightFinished;
69  LayerId _pendingAnim;
70  Common::String _flyAnim;
71  Common::String _interceptAnim;
72  Common::String _hitAnim;
73  int _startScale;
74  int _flightLengthMs;
75  Common::Point _start, _target, _attractor1, _attractor2;
76 };
77 
78 class Battleground {
79 public:
80  Battleground();
81 
82  int getNumOfProjectiles();
83  void launchProjectile(int startScale, Common::Point startPoint, int xmomentum);
84  void handleAbsoluteClick(Common::Point p);
85  void tick();
86  void stopFight();
87 
88  int _level;
89  int _leavesRemaining;
90  Monster _monsterNum;
91  bool _isInFight;
92 
93 private:
94  void stopProjectiles();
95 
97  int _projectileId;
98 };
99 
100 struct Typhoon {
102  void handleEvent(int eventId);
103  void enterTyphoon(int level);
104  void handleClick(Common::SharedPtr<Typhoon> backRef,
105  const Common::String &name);
106  void hideHead(int idx);
107  void typhoonA();
108  void schedule15154();
109  int typhonGetNumAliveHeads();
110  void hitTyphoonHead(Common::SharedPtr<Typhoon> backRef, int idx);
111  void showHeadNormal(int idx);
112 
113  static void stopAnims();
114  static void disableHotzones();
115 
116  bool _headIsAlive[18];
117  bool _playingTyphoonRespawnSound;
118  bool _playingTyphoonDieSound;
119  bool _isKilled;
120  Common::SharedPtr<Battleground> _battleground;
121 };
122 
123 class Cyclops {
124 public:
126  void handleEvent(int eventId);
127  void handleClick(Common::Point p);
128  void enterCyclops(int level);
129 
130 private:
131  bool cyclopsIsHit(Common::Point p, int frame);
132  bool cyclopsIsHitBA0(Common::Point p, int frame);
133  unsigned getSquareOfPrecision();
134  void cyclopsState0();
135  void cyclopsState1();
136  void cyclopsState2();
137  void cyclopsState3();
138  void cyclopsState4();
139  void cyclopsState5();
140  void cyclopsState6();
141 
142  Common::SharedPtr<Battleground> _battleground;
143  bool _cyclopsIsHiding;
144  int _cyclopsProximityCheckCountdown;
145  int _currentCyclopsState;
146 };
147 
149 public:
150  Bird(int id);
151 
152  void launch(int level);
153 
154  void stop();
155 
156  FlightPosition getFlightPosition(double t);
157 
158  void handleAbsoluteClick(Common::Point p);
159 
160  // Event 15201
161  void tick(Common::SharedPtr <Bird> backRef, Common::SharedPtr<Battleground> battleground);
162 
163  void makeFlightParams();
164 
165  int _id;
166  int _level;
167  bool _isActive;
168  Common::Point _startPos;
169  int _flightLengthMs;
170  int _flightStart;
171  int _flightCounterMs;
172  int _flightShootAnimFrame;
173  int _flightShootProjectileFrame;
174  int _flightShootEndFrame;
175  bool _hasShot;
176 
177  Common::Point _targetPos;
178  Common::Point _attractor1;
179  Common::Point _attractor2;
180 
181  int _birdType;
182 
183  int _field84; // ?
184 };
185 
186 class Illusion {
187 public:
189  void handleEvent(int eventId);
190  void handleAbsoluteClick(Common::Point p);
191  void handleClick(const Common::String &name);
192  void enterIllusion(int level);
193  void tick();
194  static void stopAnims();
195 private:
196  void movePhil();
197  void launchBird();
198 
199  Common::SharedPtr<Bird> _birds[3];
200  int _philPosition;
201  bool _illusionIsKilled;
202  Common::SharedPtr<Battleground> _battleground;
203 };
204 
205 }
Definition: str.h:59
Definition: ambient.h:30
Definition: array.h:52
Definition: video.h:78
Definition: monster.h:39
Definition: noncopyable.h:39
Definition: monster.h:78
Definition: monster.h:44
Definition: monster.h:148
Definition: monster.h:100
Definition: monster.h:186
Definition: rect.h:45
Definition: monster.h:123
Definition: ptr.h:159