1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef PRINCE_HERO_H
#define PRINCE_HERO_H
#include "common/scummsys.h"
#include "common/array.h"
#include "common/memstream.h"
#include "graphics/surface.h"
#include "graphics/primitives.h"
namespace Prince {
class Animation;
class PrinceEngine;
class GraphicsMan;
class Hero {
public:
static const int16 kMaxPicWidth = 1280;
static const int16 kMaxPicHeight = 480;
static const uint32 kMoveSetSize = 26;
static const int16 kZoomStep = 4;
static const int32 kZoomBitmapLen = kMaxPicHeight / kZoomStep * kMaxPicWidth / kZoomStep;
static const int16 kZoomBitmapWidth = kMaxPicWidth / kZoomStep;
static const int16 kZoomBitmapHeight = kMaxPicHeight / kZoomStep;
static const int16 kShadowLineArraySize = 2 * 1280 * 4;
static const int32 kShadowBitmapSize = kMaxPicWidth * kMaxPicHeight / 8;
static const int16 kScreenWidth = 640;
enum State {
STAY = 0,
TURN = 1,
MOVE = 2,
BORE = 3,
SPEC = 4,
TALK = 5,
MVAN = 6,
TRAN = 7,
RUN = 8,
DMOVE = 9
};
enum Direction {
LEFT = 1,
RIGHT = 2,
UP = 3,
DOWN = 4
};
enum MoveSet {
Move_SL,
Move_SR,
Move_SU,
Move_SD,
Move_ML,
Move_MR,
Move_MU,
Move_MD,
Move_TL,
Move_TR,
Move_TU,
Move_TD,
Move_MLU,
Move_MLD,
Move_MLR,
Move_MRU,
Move_MRD,
Move_MRL,
Move_MUL,
Move_MUR,
Move_MUD,
Move_MDL,
Move_MDR,
Move_MDU,
Move_BORED1,
Move_BORED2
};
Hero(PrinceEngine *vm, GraphicsMan *graph);
~Hero();
bool loadAnimSet(uint32 heroAnimNumber);
Graphics::Surface *getSurface();
void setPos(int16 x, int16 y) { _middleX = x; _middleY = y; }
void setVisible(bool flag) { _visible = flag; }
void showHero();
void moveHero();
void rotateHero();
void scrollHero();
void setScale(int8 zoomBitmapValue);
int getScaledValue(int size);
void selectZoom();
void countDrawPosition();
void checkNak();
Graphics::Surface *zoomSprite(Graphics::Surface *heroFrame);
void showHeroAnimFrame();
void line(int x1, int y1, int x2, int y2);
void plotPoint(int x, int y);
void showHeroShadow(Graphics::Surface *heroFrame);
void setShadowScale(int32 shadowScale);
void specialAnim();
void getState();
//private:
PrinceEngine *_vm;
GraphicsMan *_graph;
uint16 _number;
uint16 _visible;
int16 _state;
int16 _middleX; // middle of X
int16 _middleY; // lower part of hero
int16 _lastDirection;
int16 _destDirection;
int16 _moveSetType;
int8 _zoomFactor;
int16 _scaleValue;
int16 _frameXSize;
int16 _frameYSize;
int16 _scaledFrameXSize;
int16 _scaledFrameYSize;
int16 _drawX;
int16 _drawY;
int16 _lightX; // for hero's shadow
int16 _lightY;
int32 _shadZoomFactor;
int32 _shadScaleValue;
int32 _shadLineLen;
int16 _shadDrawX;
int16 _shadDrawY;
// Coords array of coordinates
// DirTab array of directions
// CurrCoords current coordinations
// CurrDirTab current direction
// LastDir previous move direction
// DestDir
// LeftRight previous left/right direction
// UpDown previous up/down direction
int32 _phase; // Phase animation phase
// Step x/y step size depends on direction
// MaxBoredom stand still timeout
int16 _boredomTime;// Boredom current boredom time in frames
uint16 _boreNum; // Bore anim frame
int16 _talkTime; // TalkTime time of talk anim
int32 _specAnim; // SpecAnim additional anim
uint16 _currHeight; // height of current anim phase
// Inventory array of items
// Inventory2 array of items
// Font subtitiles font
// Color subtitiles color
// AnimSet number of animation set
Common::Array<Animation *> _moveSet; // MoveAnims MoveSet
// TurnAnim ??
byte *_zoomBitmap;
byte *_shadowBitmap;
byte *_shadowLine;
uint32 _moveDelay;
uint32 _shadMinus;
};
}
#endif
/* vim: set tabstop=4 noexpandtab: */
|