ScummVM API documentation
hero.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 PRINCE_HERO_H
23#define PRINCE_HERO_H
24
25#include "common/scummsys.h"
26#include "common/array.h"
27#include "common/memstream.h"
28
29#include "graphics/surface.h"
30#include "graphics/primitives.h"
31
32namespace Prince {
33
34class Animation;
35class PrinceEngine;
36class GraphicsMan;
37struct InventoryItem;
38struct DrawNode;
39
40class Hero {
41public:
42 static const uint32 kMoveSetSize = 26;
43 static const int16 kStepLeftRight = 8;
44 static const int16 kStepUpDown = 4;
45 static const int16 kHeroShadowZ = 2;
46
47 enum State {
48 kHeroStateStay,
49 kHeroStateTurn,
50 kHeroStateMove,
51 kHeroStateBore,
52 kHeroStateSpec,
53 kHeroStateTalk,
54 kHeroStateMvan,
55 kHeroStateTran,
56 kHeroStateRun,
57 kHeroStateDelayMove
58 };
59
60 enum Direction {
61 kHeroDirLeft = 1,
62 kHeroDirRight = 2,
63 kHeroDirUp = 3,
64 kHeroDirDown = 4
65 };
66
67 enum MoveSet {
68 kMove_SL,
69 kMove_SR,
70 kMove_SU,
71 kMove_SD,
72 kMove_ML,
73 kMove_MR,
74 kMove_MU,
75 kMove_MD,
76 kMove_TL,
77 kMove_TR,
78 kMove_TU,
79 kMove_TD,
80 kMove_MLU,
81 kMove_MLD,
82 kMove_MLR,
83 kMove_MRU,
84 kMove_MRD,
85 kMove_MRL,
86 kMove_MUL,
87 kMove_MUR,
88 kMove_MUD,
89 kMove_MDL,
90 kMove_MDR,
91 kMove_MDU,
92 kMove_BORED1,
93 kMove_BORED2
94 };
95
96 // Used instead of offset in getData
97 enum AttrId {
98 kHeroLastDir = 26,
99 kHeroAnimSet = 120
100 };
101
102 uint16 getData(AttrId dataId);
103
104 Hero(PrinceEngine *vm, GraphicsMan *graph);
105 ~Hero();
106 bool loadAnimSet(uint32 heroAnimNumber);
107
108 Graphics::Surface *getSurface();
109
110 void setPos(int16 x, int16 y) { _middleX = x; _middleY = y; }
111 void setVisible(bool flag) { _visible = flag; }
112
113 void showHero();
114 void drawHero();
115 void freeZoomedSurface();
116 void heroStanding();
117 void heroMoveGotIt(int x, int y, int dir);
118 int rotateHero(int oldDirection, int newDirection);
119 void scrollHero();
120 void setScale(int8 zoomBitmapValue);
121 int getScaledValue(int size);
122 void selectZoom();
123 void countDrawPosition();
124 Graphics::Surface *zoomSprite(Graphics::Surface *heroFrame);
125 void line(int x1, int y1, int x2, int y2);
126 void plotPoint(int x, int y);
127 static void showHeroShadow(Graphics::Surface *screen, DrawNode *drawNode);
128 void drawHeroShadow(Graphics::Surface *heroFrame);
129 void freeOldMove();
130 void freeHeroAnim();
131
132 uint16 _number;
133 uint16 _visible;
134 int16 _state;
135 int16 _middleX; // middle of X
136 int16 _middleY; // lower part of hero
137 int16 _moveSetType;
138
139 int16 _frameXSize;
140 int16 _frameYSize;
141 int16 _scaledFrameXSize;
142 int16 _scaledFrameYSize;
143 int16 _drawX;
144 int16 _drawY;
145 int16 _drawZ;
146
147 byte *_coords; // array of coordinates
148 byte *_dirTab; // array of directions
149 byte *_currCoords; // current coordinations
150 byte *_currDirTab; // current direction
151 int16 _lastDirection; // previous move direction
152 int16 _destDirection;
153 int16 _leftRightMainDir; // left or right - dominant direction
154 int16 _upDownMainDir; // up or down - dominant direction
155 int32 _phase; // Phase animation phase
156 int16 _step; // Step x/y step size depends on direction
157 int16 _maxBoredom; // stand still timeout
158 int16 _boredomTime; // Boredom current boredom time in frames
159 uint16 _boreNum; // Bore anim frame
160 int16 _talkTime; // TalkTime time of talk anim
161 Animation *_specAnim; // additional anim
162 Graphics::Surface *_zoomedHeroSurface;
163
164 uint16 _currHeight; // height of current anim phase
165
166 Common::Array<byte> _inventory; // Inventory array of items
167 Common::Array<byte> _inventory2; // Inventory2 array of items
168 // Font subtitiles font
169 int _color; // subtitles color
170 uint32 _animSetNr; // number of animation set
171 Common::Array<Animation *> _moveSet; // MoveAnims MoveSet
172
173 uint32 _moveDelay;
174 uint32 _shadMinus;
175
176private:
177 PrinceEngine *_vm;
178 GraphicsMan *_graph;
179};
180
181} // End of namespace Prince
182
183#endif
Definition: animation.h:32
Definition: graphics.h:33
Definition: hero.h:40
Definition: prince.h:282
Definition: surface.h:67
Definition: prince.h:258