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 #include "common/array.h"
28 
29 namespace LastExpress {
30 
31 class Fight;
32 class Sequence;
33 class SequenceFrame;
34 
35 class Fighter {
36 public:
37  enum FightAction {
38  kFightActionNone = 0,
39  kFightAction1 = 1,
40  kFightAction2 = 2,
41  kFightAction3 = 3,
42  kFightAction4 = 4,
43  kFightAction5 = 5,
44  kFightAction101 = 101,
45  kFightActionResetFrame = 102,
46  kFightAction103 = 103,
47  kFightActionWin = 104,
48  kFightActionLost = 105,
49  kFightAction128 = 128,
50  kFightAction129 = 129,
51  kFightAction130 = 130,
52  kFightAction131 = 131,
53  kFightAction132 = 132
54  };
55 
56  enum FightSequenceType {
57  kFightSequenceType0 = 0,
58  kFightSequenceType1 = 1,
59  kFightSequenceType2 = 2
60  };
61 
62  Fighter(LastExpressEngine *engine);
63  virtual ~Fighter();
64 
65  // Default functions
66  virtual void handleAction(FightAction action);
67  virtual void update();
68  virtual bool canInteract(FightAction action = kFightActionNone);
69 
70  // Drawing
71  void setSequenceAndDraw(uint32 sequenceIndex, FightSequenceType type);
72 
73  // Accessors
74  void setOpponent(Fighter *opponent) { _opponent = opponent; }
75  void setCountdown(int32 countdown) { _countdown = countdown; }
76  void setFight(Fight *fight) { _fight = fight; }
77 
78  int getCountdown() { return _countdown; }
79  uint32 getSequenceIndex() { return _sequenceIndex; }
80  uint32 getField34() { return _field_34; }
81 
82 protected:
83  LastExpressEngine *_engine;
84  Fight *_fight;
85  Fighter *_opponent;
86  Sequence *_sequence;
87  SequenceFrame *_frame;
88  uint32 _sequenceIndex;
89  Common::Array<Sequence *> _sequences;
90  uint32 _frameIndex;
91  uint32 _field_24;
92  FightAction _action;
93  uint32 _sequenceIndex2;
94  int32 _countdown; // countdown before loosing ?
95  uint32 _field_34;
96 
97  // Drawing and processing
98  void draw();
99  void process();
100 
101  // Helpers
102  bool checkFrame(uint32 val);
103 };
104 
105 class Opponent : public Fighter {
106 public:
107  Opponent(LastExpressEngine *engine) : Fighter(engine) {
108  _field_38 = 0;
109  }
110 
111  void update() override;
112 
113 protected:
114  int32 _field_38;
115 };
116 
117 } // End of namespace LastExpress
118 
119 #endif // LASTEXPRESS_FIGHTER_H
Definition: lastexpress.h:69
Definition: array.h:52
Definition: fighter.h:35
Definition: animation.h:45
Definition: fight.h:67
Definition: sequence.h:151
Definition: sequence.h:183
Definition: fighter.h:105