ScummVM API documentation
beetle.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_BEETLE_H
23 #define LASTEXPRESS_BEETLE_H
24 
25 #include "lastexpress/data/sequence.h"
26 
27 #include "lastexpress/helpers.h"
28 
29 #include "common/array.h"
30 #include "common/system.h"
31 
32 namespace LastExpress {
33 
34 class LastExpressEngine;
35 
36 class Beetle {
37 public:
38 
39  Beetle(LastExpressEngine *engine);
40  ~Beetle();
41 
42  void update();
43 
44  void load();
45  void unload();
46 
47  bool isLoaded() const;
48 
49  bool catchBeetle();
50  bool isCatchable() const;
51 
52 private:
53  struct BeetleData {
54  Common::Array<Sequence *> sequences;
55 
56  uint32 field_74;
57  Sequence *currentSequence;
58  uint32 currentFrame;
59  uint32 index;
60  int16 coordOffset;
61  int16 field_86;
62 
63  int16 coordX;
64  int16 coordY;
65 
66  uint32 indexes[16];
67 
68  uint32 offset;
69  SequenceFrame *frame;
70  bool isLoaded;
71  uint32 field_D5;
72  uint32 field_D9;
73  uint32 field_DD;
74 
75  BeetleData() {
76  field_74 = 0;
77  currentSequence = NULL;
78  currentFrame = 0;
79  index = 0;
80  coordOffset = 0;
81 
82  field_86 = 0;
83 
84  coordX = 0;
85  coordY = 0;
86 
87  memset(indexes, 0, sizeof(indexes));
88  offset = 0;
89 
90  frame = NULL;
91  isLoaded = false;
92  field_D5 = 0;
93  field_D9 = 0;
94  field_DD = 0;
95  }
96 
97  ~BeetleData() {
98  for (int i = 0; i < (int)sequences.size(); i++)
99  SAFE_DELETE(sequences[i]);
100 
101  sequences.clear();
102  }
103  };
104 
105  LastExpressEngine *_engine;
106 
107  BeetleData *_data;
108 
109  void move();
110  void updateFrame(SequenceFrame *frame) const;
111  void updateData(uint32 index);
112  void drawUpdate();
113  void invertDirection();
114 };
115 
116 } // End of namespace LastExpress
117 
118 #endif // LASTEXPRESS_BEETLE_H
Definition: lastexpress.h:69
Definition: array.h:52
void clear()
Definition: array.h:320
Definition: beetle.h:36
Definition: animation.h:45
Definition: sequence.h:151
size_type size() const
Definition: array.h:315
Definition: sequence.h:183