ScummVM API documentation
player.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_PLAYER_H
23 #define ACCESS_PLAYER_H
24 
25 #include "common/scummsys.h"
26 #include "common/rect.h"
27 #include "common/serializer.h"
28 #include "access/asurface.h"
29 #include "access/data.h"
30 
31 namespace Access {
32 
33 enum Direction {
34  NONE = 0,
35  UP = 1,
36  DOWN = 2,
37  LEFT = 3,
38  RIGHT = 4,
39  UPRIGHT = 5,
40  DOWNRIGHT = 6,
41  UPLEFT = 7,
42  DOWNLEFT = 8
43 };
44 
45 class AccessEngine;
46 
47 class Player : public ImageEntry, public Manager {
48 protected:
49  int _leftDelta, _rightDelta;
50  int _upDelta, _downDelta;
51  int _scrollConst;
52  int _sideWalkMin, _sideWalkMax;
53  int _upWalkMin, _upWalkMax;
54  int _downWalkMin, _downWalkMax;
55  int _diagUpWalkMin, _diagUpWalkMax;
56  int _diagDownWalkMin, _diagDownWalkMax;
57  SpriteResource *_playerSprites1;
58  int _scrollEnd;
59  int _inactiveYOff;
60 
61  void plotCom(int v1);
62  void plotCom0();
63  void plotCom1();
64  void plotCom2();
65  void plotCom3();
66 
67  void walkUp();
68  void walkDown();
69  void walkLeft();
70  void walkRight();
71  void walkUpLeft();
72  void walkDownLeft();
73  void walkUpRight();
74  void walkDownRight();
75  void checkScrollUp();
76 public:
77  Direction _playerDirection;
78  SpriteResource *_playerSprites;
79  // Fields in original Player structure
80  byte *_manPal1;
81  int *_walkOffRight;
82  int *_walkOffLeft;
83  int *_walkOffUp;
84  int *_walkOffDown;
85  Common::Point *_walkOffUR;
86  Common::Point *_walkOffDR;
87  Common::Point *_walkOffUL;
88  Common::Point *_walkOffDL;
89  byte _rawTempL;
90  int _rawXTemp;
91  byte _rawYTempL;
92  int _rawYTemp;
93  Common::Point _playerOffset;
94  int _playerXLow;
95  int _playerX;
96  int _playerYLow;
97  int _playerY;
98  int _frame;
99  int _xFlag, _yFlag;
100  Direction _move;
101 
102  // Additional public globals we've added to new Player class
103  bool _playerOff;
104  bool _playerMove;
105  Common::Point _moveTo;
106  bool _collideFlag;
107  bool _scrollFlag;
108  int _scrollThreshold;
109  int _scrollAmount;
110 
111  // Additional globals that need to be saved
112  int _roomNumber;
113  Common::Point _rawPlayerLow;
114  Common::Point _rawPlayer;
115 public:
116  Player(AccessEngine *vm);
117  virtual ~Player();
118  static Player *init(AccessEngine *vm);
119 
120  virtual void load();
121 
122  void loadTexPalette();
123 
124  void loadSprites(const Common::Path &name);
125 
126  void freeSprites();
127 
128  void removeSprite1();
129 
130  void calcManScale();
131 
132  void walk();
133 
134  void calcPlayer();
135 
136  bool scrollUp(int forcedAmount = -1);
137  bool scrollDown(int forcedAmount = -1);
138  bool scrollLeft(int forcedAmount = -1);
139  bool scrollRight(int forcedAmount = -1);
140  void checkScroll();
141 
142  void checkMove();
143 
148 };
149 
150 } // End of namespace Access
151 
152 #endif /* ACCESS_PLAYER_H */
void synchronize(Common::Serializer &s)
Definition: data.h:37
Definition: access.h:84
Definition: path.h:52
Definition: player.h:47
Definition: serializer.h:79
Definition: asurface.h:138
Definition: rect.h:45
Definition: access.h:62
Definition: asurface.h:157