ScummVM API documentation
amazon_logic.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 ACCESS_AMAZON_LOGIC_H
23 #define ACCESS_AMAZON_LOGIC_H
24 
25 #include "common/scummsys.h"
26 #include "access/scripts.h"
27 #include "access/asurface.h"
28 #include "access/amazon/amazon_resources.h"
29 
30 namespace Access {
31 namespace Amazon {
32 
33 class AmazonEngine;
34 
35 #define PAN_SIZE 32
36 
38 protected:
39  AmazonEngine *_vm;
40 public:
41  AmazonManager(AmazonEngine *vm) : _vm(vm) {}
42 };
43 
44 class PannedScene : public AmazonManager {
45  struct PanEntry {
46  SpriteResource *_pObject;
47  int _pImgNum;
48  int _pObjX;
49  int _pObjY;
50  int _pObjZ;
51  int _pObjXl;
52  int _pObjYl;
53  };
54 protected:
55  int _xCount;
56  int _xTrack;
57  int _yTrack;
58  int _zTrack;
59  int _xCam;
60  int _yCam;
61  int _zCam;
62  int _pNumObj;
63 
64  PanEntry _pan[PAN_SIZE];
65 public:
67 
68  void pan();
69 };
70 
71 class CampScene : public PannedScene {
72 protected:
73  bool _skipStart;
74 public:
76 
77  void mWhileDoOpen();
78 };
79 
80 class Opening : public CampScene {
81 private:
82  int _pCount;
83 
84  void doTitle();
85  void doCredit();
86  void doCreditDemo();
87  void scrollTitle();
88  void doTent();
89 public:
90  Opening(AmazonEngine *vm);
91 
92  void doIntroduction();
93 };
94 
95 class Plane : public PannedScene {
96 public:
97  int _pCount;
98  Common::Point _position;
99  int _planeCount;
100  int _propCount;
101 
102  void doFlyCell();
103  void doFallCell();
104  void scrollFly();
105  void scrollFall();
106  void mWhileFly();
107  void mWhileFall();
108 public:
109  Plane(AmazonEngine *vm);
110 };
111 
112 #define JUNGLE_SIZE 3
113 class Jungle : public CampScene {
114 private:
115  void initJWalk2();
116  void jungleMove();
117  void scrollJWalk();
118 
119  int _jCnt[JUNGLE_SIZE];
120  int _jungleX[JUNGLE_SIZE];
121 public:
122  Jungle(AmazonEngine *vm);
123 
124  void mWhileJWalk();
125  void mWhileJWalk2();
126 };
127 
128 class Guard : public PannedScene {
129 private:
130  int _guardCel;
131  Common::Point _position;
132  int _gCode1;
133  int _gCode2;
134  Common::Point _topLeft;
135  Common::Point _bottomRight;
136  int _xMid, _yMid;
137 
138  void chkVLine();
139  void chkHLine();
140  void setVerticalCode();
141  void setHorizontalCode();
142  void guardSee();
143  void setGuardFrame();
144 public:
145  Guard(AmazonEngine *vm);
146 
147  void doGuard();
148 
149  void setPosition(const Common::Point &pt);
150 };
151 
152 class Cast : public PannedScene {
153 public:
154  Cast(AmazonEngine *vm);
155 
156  void doCast(int param1);
157 };
158 
159 class River : public PannedScene {
160 private:
161  bool _chickenOutFl;
162  const byte *_mapPtr;
163  int _canoeVXPos;
164  int _canoeMoveCount;
165  int _canoeFrame;
166  RiverStruct *_topList;
167  RiverStruct *_botList;
168  int _canoeDir;
169  bool _saveRiver;
170  bool _deathFlag;
171  int _deathCount;
172  int _deathType;
173  int _maxHits;
174 
175  // Saved fields
176  int _canoeLane;
177  int _canoeYPos;
178  int _hitCount;
179  int _riverIndex;
180  int _hitSafe;
181  int _rScrollRow;
182  int _rScrollCol;
183  int _rScrollX;
184  int _rScrollY;
185  int _mapOffset;
186  int _screenVertX;
187  int _oldScrollCol;
188 
189  void initRiver();
190  void resetPositions();
191  void checkRiverPan();
192  bool riverJumpTest();
193  void riverSound();
194  void moveCanoe();
195  void moveCanoe2();
196  void updateObstacles();
197  void riverSetPhysX();
198  bool checkRiverCollide();
199  void plotRiver();
200  void scrollRiver();
201  void scrollRiver1();
202  void setRiverPan();
203 public:
204  River(AmazonEngine *vm);
205 
206  void doRiver();
207  void mWhileDownRiver();
208 
209  void synchronize(Common::Serializer &s);
210 };
211 
212 enum AntDirection { ANT_RIGHT = 0, ANT_LEFT = 1 };
213 
214 class Ant : public AmazonManager {
215 private:
216  AntDirection _antDirection;
217  AntDirection _pitDirection;
218  int _antCel;
219  int _torchCel;
220  int _pitCel;
221  int _stabCel;
222  Common::Point _antPos;
223  bool _antDieFl;
224  bool _antEatFl;
225  bool _stabFl;
226  Common::Point _pitPos;
227 
228  void plotTorchSpear(int indx, const int *&buf);
229  void plotPit(int indx, const int *&buf);
230  int antHandleRight(int indx, const int *&buf);
231  int antHandleLeft(int indx, const int *&buf);
232  int antHandleStab(int indx, const int *&buf);
233 public:
234  Ant(AmazonEngine *vm);
235 
236  void doAnt();
237 
238  void synchronize(Common::Serializer &s);
239 };
240 
241 class InactivePlayer : public ImageEntry {
242 public:
243  SpriteResource *_altSpritesPtr;
244 
245  InactivePlayer() { _altSpritesPtr = nullptr; }
246 };
247 
248 } // End of namespace Amazon
249 
250 } // End of namespace Access
251 
252 #endif /* ACCESS_AMAZON_LOGIC_H */
Definition: amazon_logic.h:80
Definition: amazon_logic.h:37
Definition: amazon_logic.h:44
Definition: amazon_logic.h:71
Definition: amazon_logic.h:159
Definition: amazon_game.h:34
Definition: amazon_logic.h:241
Definition: amazon_logic.h:152
Definition: serializer.h:79
Definition: asurface.h:138
Definition: amazon_logic.h:214
Definition: rect.h:45
Definition: amazon_logic.h:95
Definition: amazon_logic.h:128
Definition: access.h:62
Definition: amazon_logic.h:113
Definition: amazon_resources.h:38
Definition: asurface.h:157