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