ScummVM API documentation
fighter.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 LASTEXPRESS_FIGHTER_H
23 #define LASTEXPRESS_FIGHTER_H
24 
25 #include "lastexpress/fight/fight.h"
26 
27 namespace LastExpress {
28 
29 class LastExpressEngine;
30 class CFight;
31 
32 struct Seq;
33 struct Sprite;
34 
35 class CFighter {
36 
37 public:
38  CFighter(LastExpressEngine *engine, CFight *fight);
39  virtual ~CFighter();
40 
41  virtual void timer();
42  void doAction(int sequenceIndex, int action);
43  void newSeq();
44  bool init(CFighter *opponent);
45  virtual bool actionAvailable(int action);
46  int getAction();
47  int getDodges();
48  int getHitPoints();
49  void setHitPoints(int hitPoints);
50  bool isDead();
51  virtual void send(int action);
52 
53 protected:
54  LastExpressEngine *_engine = nullptr;
55 
56  CFight *_fight = nullptr;
57  CFighter *_opponent = nullptr;
58  Seq *_seqs[10];
59  int _numSeqs = 0;
60  int _currentActionIdx = 0;
61  Seq *_currentSeq = nullptr;
62  Sprite *_currentSprite = nullptr;
63  int _currentSpriteIdx = 0;
64  int _unusedFlag = 0;
65  int _nextMessage = 0;
66  int _nextSequenceIdx = 0;
67  int _hitPoints = 0;
68  int _dodges = 0;
69  int _timer = 0;
70 };
71 
72 // Generic fighters
73 
74 class CCath : public CFighter {
75 public:
76  CCath(LastExpressEngine *engine, CFight *fight) : CFighter(engine, fight) {}
77 
78  virtual void timer() override;
79 };
80 
81 class COpponent : public CFighter {
82 public:
83  COpponent(LastExpressEngine *engine, CFight *fight) : CFighter(engine, fight) {}
84 
85  virtual void timer() override;
86 };
87 
88 
89 // First fight: Cath vs Milos
90 
91 class CCath1 : public CCath {
92 public:
93  CCath1(LastExpressEngine *engine, CFight *fight);
94 
95  void timer() override;
96  bool actionAvailable(int action) override;
97  void send(int action) override;
98 };
99 
100 class COpponent1 : public COpponent {
101 public:
102  COpponent1(LastExpressEngine *engine, CFight *fight);
103 
104  void timer() override;
105  void send(int action) override;
106 };
107 
108 
109 // Second fight: Cath vs Vesna (when saving Anna)
110 
111 class CCath2 : public CCath {
112 public:
113  CCath2(LastExpressEngine *engine, CFight *fight);
114 
115  void send(int action) override;
116 };
117 
118 class COpponent2 : public COpponent {
119 public:
120  COpponent2(LastExpressEngine *engine, CFight *fight);
121 
122  void timer() override;
123 };
124 
125 
126 // Third fight: Cath vs Ivo
127 
128 class CCath3 : public CCath {
129 public:
130  CCath3(LastExpressEngine *engine, CFight *fight);
131 
132  void timer() override;
133  bool actionAvailable(int action) override;
134  void send(int action) override;
135 };
136 
137 class COpponent3 : public COpponent {
138 public:
139  COpponent3(LastExpressEngine *engine, CFight *fight);
140 
141  void timer() override;
142  void send(int action) override;
143 };
144 
145 
146 // Fourth fight: Cath vs Salko
147 
148 class CCath4 : public CCath {
149 public:
150  CCath4(LastExpressEngine *engine, CFight *fight);
151 
152  void timer() override;
153  bool actionAvailable(int action) override;
154  void send(int action) override;
155 };
156 
157 class COpponent4 : public COpponent {
158 public:
159  COpponent4(LastExpressEngine *engine, CFight *fight);
160 
161  void timer() override;
162  void send(int action) override;
163 };
164 
165 
166 // Fifth fight: Cath vs Vesna (final fight)
167 
168 class CCath5 : public CCath {
169 public:
170  CCath5(LastExpressEngine *engine, CFight *fight);
171 
172  void timer() override;
173  bool actionAvailable(int action) override;
174  void send(int action) override;
175 };
176 
177 class COpponent5 : public COpponent {
178 public:
179  COpponent5(LastExpressEngine *engine, CFight *fight);
180 
181  void timer() override;
182  void send(int action) override;
183 };
184 
185 } // End of namespace LastExpress
186 
187 #endif // LASTEXPRESS_FIGHTER_H
Definition: fighter.h:157
Definition: lastexpress.h:523
Definition: fighter.h:100
Definition: fighter.h:74
Definition: fighter.h:168
Definition: fighter.h:137
Definition: archive.h:29
Definition: fighter.h:81
Definition: fighter.h:35
Definition: fighter.h:111
Definition: lastexpress.h:212
Definition: lastexpress.h:159
Definition: fighter.h:148
Definition: fighter.h:91
Definition: fighter.h:177
Definition: fighter.h:128
Definition: fighter.h:118
Definition: fight.h:35