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  int _jetpackFlag;
61 
62  void plotCom(int v1);
63  void plotCom0();
64  void plotCom1();
65  void plotCom2();
66  void plotCom3();
67 
68  void walkUp();
69  void walkDown();
70  void walkLeft();
71  void walkRight();
72  void walkUpLeft();
73  void walkDownLeft();
74  void walkUpRight();
75  void walkDownRight();
76  void checkScrollUp();
77 
78  bool isMMHover() const;
79  void jetpack();
80 
81 public:
82  Direction _playerDirection;
83  SpriteResource *_playerSprites;
84  // Fields in original Player structure
85  byte *_manPal1;
86  int *_walkOffRight;
87  int *_walkOffLeft;
88  int *_walkOffUp;
89  int *_walkOffDown;
90  Common::Point *_walkOffUR;
91  Common::Point *_walkOffDR;
92  Common::Point *_walkOffUL;
93  Common::Point *_walkOffDL;
94  byte _rawTempL;
95  int _rawXTemp;
96  byte _rawYTempL;
97  int _rawYTemp;
98  Common::Point _playerOffset;
99  int _playerXLow;
100  int _playerX;
101  int _playerYLow;
102  int _playerY;
103  int _frame;
104  int _xFlag, _yFlag;
105  Direction _move;
106 
107  // Additional public globals we've added to new Player class
108  bool _playerOff;
109  bool _playerMove;
110  Common::Point _moveTo;
111  bool _collideFlag;
112  bool _scrollFlag;
113  int _scrollThreshold;
114  int _scrollAmount;
115 
116  // Additional globals that need to be saved
117  int _roomNumber;
118  Common::Point _rawPlayerLow;
119  Common::Point _rawPlayer;
120 public:
121  Player(AccessEngine *vm);
122  virtual ~Player();
123  static Player *init(AccessEngine *vm);
124 
125  virtual void load();
126 
127  void loadTexPalette();
128 
129  void loadSprites(const Common::Path &name);
130 
131  void freeSprites();
132 
133  void removeSprite1();
134 
135  void calcManScale();
136 
137  void extracted();
138 
139  void walk();
140 
141  void calcPlayer();
142 
143  bool scrollUp(int forcedAmount = -1);
144  bool scrollDown(int forcedAmount = -1);
145  bool scrollLeft(int forcedAmount = -1);
146  bool scrollRight(int forcedAmount = -1);
147  void checkScroll();
148 
149  void checkMove();
150 
155 };
156 
157 } // End of namespace Access
158 
159 #endif /* ACCESS_PLAYER_H */
void synchronize(Common::Serializer &s)
Definition: data.h:37
Definition: access.h:139
Definition: path.h:52
Definition: player.h:47
Definition: serializer.h:79
Definition: asurface.h:139
Definition: rect.h:144
Definition: access.h:62
Definition: asurface.h:159