ScummVM API documentation
walk.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 QUEEN_WALK_H
23 #define QUEEN_WALK_H
24 
25 #include "common/util.h"
26 #include "queen/structs.h"
27 
28 namespace Queen {
29 
31  int16 firstFrame;
32  int16 lastFrame;
33  Direction facing;
34 
35  void set(int16 ff, int16 lf, Direction dir) {
36  firstFrame = ff;
37  lastFrame = lf;
38  facing = dir;
39  }
40 };
41 
42 struct WalkData {
43  int16 dx, dy;
44  const Area *area;
45  uint16 areaNum;
46  MovePersonAnim anim;
47 };
48 
50  const char *name;
51  int16 walkLeft1, walkLeft2;
52  int16 walkRight1, walkRight2;
53  int16 walkBack1, walkBack2;
54  int16 walkFront1, walkFront2;
55  uint16 frontStandingFrame;
56  uint16 backStandingFrame;
57  uint16 animSpeed;
58  uint16 moveSpeed;
59 };
60 
61 class QueenEngine;
62 
63 class Walk {
64 public:
65 
66  Walk(QueenEngine *vm);
67 
68  int16 moveJoe(int direction, int16 endx, int16 endy, bool inCutaway);
69  int16 movePerson(const Person *pp, int16 endx, int16 endy, uint16 curImage, int direction);
70 
71  void stopJoe();
72  void stopPerson(uint16 bobNum);
73 
74  enum {
75  MAX_WALK_DATA = 16
76  };
77 
78 private:
79 
80  void animateJoePrepare();
81  void animateJoe();
82 
83  void animatePersonPrepare(const MovePersonData *mpd, int direction);
84  void animatePerson(const MovePersonData *mpd, uint16 image, uint16 bobNum, uint16 bankNum, int direction);
85 
87  static int16 calcC(int16 c1, int16 c2, int16 c3, int16 c4, int16 lastc);
88 
90  int16 findAreaPosition(int16 *x, int16 *y, bool recalibrate);
91 
93  uint16 findFreeArea(uint16 area) const;
94 
96  bool isAreaStruck(uint16 area) const;
97 
99  bool calcPath(uint16 oldArea, uint16 newArea);
100 
102  void initWalkData();
103 
105  void incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 area);
106 
108  bool calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y);
109 
110 
112  const Area *_roomArea;
113 
115  uint16 _roomAreaCount;
116 
118  WalkData _walkData[MAX_WALK_DATA];
119 
121  uint16 _walkDataCount;
122 
123  uint16 _areaStrike[MAX_WALK_DATA];
124  uint16 _areaStrikeCount;
125 
126  uint16 _areaList[MAX_WALK_DATA];
127  uint16 _areaListCount;
128 
130  bool _joeInterrupted;
131 
133  bool _joeMoveBlock;
134 
135  QueenEngine *_vm;
136 
138  static const MovePersonData _moveData[];
139 };
140 
141 } // End of namespace Queen
142 
143 #endif
Definition: structs.h:543
Definition: queen.h:62
Definition: walk.h:63
Definition: structs.h:77
Definition: bankman.h:28
Definition: walk.h:49
Definition: walk.h:42
Definition: walk.h:30