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