ScummVM API documentation
combat.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 
22 #ifndef MM1_VIEWS_ENH_COMBAT_H
23 #define MM1_VIEWS_ENH_COMBAT_H
24 
25 #include "mm/mm1/game/combat.h"
26 #include "mm/mm1/views_enh/scroll_view.h"
27 
28 namespace MM {
29 namespace MM1 {
30 namespace ViewsEnh {
31 
32 class Combat : public ScrollView, public Game::Combat {
33 private:
34  LineArray _monsterSpellLines;
35  uint _attackableCount = 0;
36  InfoMessage _spellResult;
37  bool _firstDraw = false;
38  // Combat options that have sub-option selection
39  enum SelectedOption {
40  OPTION_NONE, OPTION_DELAY, OPTION_EXCHANGE,
41  OPTION_FIGHT, OPTION_SHOOT
42  };
43  SelectedOption _option = OPTION_NONE;
44 
48  void setOption(SelectedOption option);
49 
50  void writeOptions();
51  void writeAllOptions();
52  void writeAttackOptions();
53  void writeCastOption();
54  void writeShootOption();
55 
56  void clearSurface() override;
57  void clearBottom();
58  void clearArea(const Common::Rect &r);
59  void resetBottom();
60  void writeBottomText(int x, int line, const Common::String &msg,
61  TextAlign align = ALIGN_LEFT);
62  Common::Rect getOptionButtonRect(uint col, uint row);
63  void writeOption(uint col, uint row, char c, const Common::String &msg);
64 
68  void writeHandicap();
69 
73  void writeStaticContent();
74 
78  void writeRound();
79 
84  void writePartyNumbers();
85 
89  void writeMonsters();
90 
94  void writeMonsterStatus(int monsterNum);
95 
99  void writeDots();
100 
104  void writeParty();
105 
109  void clearPartyArea();
110 
114  void writeDefeat();
115 
119  void highlightNextRound();
120 
124  void writeMonsterEffects();
125 
129  void writeMonsterAction(bool flees);
130 
134  void writeMonsterSpell();
135 
139  void writeMonsterAttack();
140 
144  void writeInfiltration();
145 
149  void writeWaitsForOpening();
150 
154  void writeSpellResult();
155 
159  void checkMonsterSpellDone();
160 
164  void delay();
165 
169  void exchange();
170 
174  void fight();
175 
179  void shoot();
180 
184  void writeCharAttackDamage();
185 
189  void writeCharAttackNoEffect();
190 
194  Common::String getAttackString();
195 
199  void writeMessage();
200 
204  void writeDelaySelect();
205 
209  void writeExchangeSelect();
210 
214  void writeFightSelect();
215 
219  void writeShootSelect();
220 
221 protected:
225  void setMode(Mode newMode) override;
226 
230  void combatDone() override;
231 
232 public:
233  Combat();
234  virtual ~Combat() {}
235 
236  void displaySpellResult(const InfoMessage &msg) override;
237 
242  void disableAttacks();
243 
247  bool msgFocus(const FocusMessage &msg) override;
248 
252  bool msgUnfocus(const UnfocusMessage &msg) override;
253 
257  bool msgGame(const GameMessage &msg) override;
258 
263  void draw() override;
264 
268  void timeout() override;
269 
273  bool msgKeypress(const KeypressMessage &msg) override;
274 
278  bool msgMouseUp(const MouseUpMessage &msg) override;
279 
283  bool msgAction(const ActionMessage &msg) override;
284 };
285 
286 } // namespace ViewsEnh
287 } // namespace MM1
288 } // namespace MM
289 
290 #endif
bool msgKeypress(const KeypressMessage &msg) override
Definition: str.h:59
bool msgAction(const ActionMessage &msg) override
Definition: messages.h:79
Definition: rect.h:144
Definition: messages.h:56
Definition: scroll_view.h:35
Definition: messages.h:49
Definition: combat.h:32
virtual ~Combat()
Definition: combat.h:234
Definition: detection.h:27
Definition: messages.h:48
Definition: messages.h:129
bool msgFocus(const FocusMessage &msg) override
bool msgMouseUp(const MouseUpMessage &msg) override
Definition: messages.h:87
Definition: combat.h:36
void displaySpellResult(const InfoMessage &msg) override
bool msgGame(const GameMessage &msg) override
void setMode(Mode newMode) override
bool msgUnfocus(const UnfocusMessage &msg) override
void combatDone() override
Definition: messages.h:41
void timeout() override