ScummVM API documentation
movers.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 * Should really be called "moving actors.h"
21 */
22
23#ifndef TINSEL_MOVERS_H // prevent multiple includes
24#define TINSEL_MOVERS_H
25
26#include "tinsel/anim.h" // for ANIM
27#include "tinsel/scene.h" // for TFTYPE
28#include "tinsel/tinsel.h"
29
30namespace Tinsel {
31
32struct OBJECT;
33
34enum NPS {NOT_IN, GOING_UP, GOING_DOWN, LEAVING, ENTERING};
35
36enum IND {NO_PROB, TRY_CENTER, TRY_CORNER, TRY_NEXTCORNER};
37
38enum DIRECTION { LEFTREEL, RIGHTREEL, FORWARD, AWAY };
39
40#define NUM_MAINSCALES ((TinselVersion >= 2) ? 10 : 5)
41#define NUM_AUXSCALES 5
42#define TOTAL_SCALES (NUM_MAINSCALES + NUM_AUXSCALES)
43#define REQ_MAIN_SCALES 10
44#define REQ_TOTAL_SCALES 15
45
46#define BOGUS_BRIGHTNESS -1
47
48enum MOVER_TYPE { MOVER_2D, MOVER_3D };
49
50struct MOVER {
51 int objX, objY; /* Co-ordinates object */
52
53 int targetX, targetY;
54 int ItargetX, ItargetY; /* Intermediate destination */
55 int UtargetX, UtargetY; /* Ultimate destination */
56
57 HPOLYGON hIpath; /* Intermediate path */
58 HPOLYGON hUpath; /* Ultimate path */
59 HPOLYGON hCpath; /* Current path */
60
61 bool over;
62 int walkNumber;
63
64 IND InDifficulty;
65
66 /* For use in 'follow nodes' polygons */
67 HPOLYGON hFnpath;
68 NPS npstatus;
69 int line;
70
71 int Tline; // NEW
72
73 // TODO: TagReelRunning may be the same as bSpecReel
74 bool bSpecReel;
75
76 /* Used internally */
77 DIRECTION direction; // Current reel
78 int scale; // Current scale
79
80 int stepCount; // Step count for walking reel synchronisation
81
82 int walkedFromX, walkedFromY;
83
84 bool bMoving; // Set this to TRUE during a walk
85
86 bool bNoPath;
87 bool bIgPath;
88 bool bWalkReel;
89
90 OBJECT *actorObj; // Actor's object
91 ANIM actorAnim; // Actor's animation script
92
93 SCNHANDLE hLastFilm; // } Used by AlterMover()
94 SCNHANDLE hPushedFilm; // }
95
96 int actorID;
97 int actorToken;
98
99 SCNHANDLE walkReels[REQ_TOTAL_SCALES][4];
100 SCNHANDLE standReels[REQ_TOTAL_SCALES][4];
101 SCNHANDLE talkReels[REQ_TOTAL_SCALES][4];
102
103 bool bActive;
104
105 int SlowFactor; // Slow down movement while hidden
106
107 bool bStop;
108
109 /* NOTE: If effect polys can overlap, this needs improving */
110 bool bInEffect;
111
112 Common::PROCESS *pProc;
113
114 // Discworld 2 specific fields
115 int32 zOverride;
116 bool bHidden;
117 int brightness; // Current brightness
118 int startColor;
119 int paletteLength;
120 HPOLYGON hRpath; // Recent path
121
122 // Noir specific fields
123 MOVER_TYPE type;
124 SCNHANDLE hModelName;
125 SCNHANDLE hTextureName;
126
127 int posX, posY, posZ;
128 int animSpeed;
129 uint nextIdleAnim;
130};
131
132struct MAINIT {
133 int X;
134 int Y;
135 MOVER *pMover;
136};
137
138//---------------------------------------------------------------------------
139
140
141void MoverProcessCreate(int X, int Y, int id, MOVER *pMover);
142
143
144enum AR_FUNCTION { AR_NORMAL, AR_PUSHREEL, AR_POPREEL, AR_WALKREEL };
145
146void StoreMoverPalette(MOVER *pMover, int startColor, int length);
147
148void MoverBrightness(MOVER *pMover, int brightness);
149
150MOVER *GetMover(int ano);
151MOVER *RegisterMover(int ano);
152void KillMover(MOVER *pMover);
153MOVER *GetLiveMover(int index);
154
155bool getMActorState(MOVER *psActor);
156int GetMoverId(MOVER *pMover);
157void SetMoverZ(MOVER *pMover, int y, uint32 zFactor);
158void SetMoverZoverride(MOVER *pMover, uint32 zFactor);
159
160void HideMover(MOVER *pMover, int sf = 0);
161bool MoverHidden(MOVER *pMover);
162bool MoverIs(MOVER *pMover);
163bool MoverIsSWalking(MOVER *pMover);
164bool MoverMoving(MOVER *pMover);
165int GetWalkNumber(MOVER *pMover);
166void UnHideMover(MOVER *pMover);
167void DropMovers();
168void PositionMover(MOVER *pMover, int x, int y);
169
170void GetMoverPosition(MOVER *pMover, int *aniX, int *aniY);
171void GetMoverMidTop(MOVER *pMover, int *aniX, int *aniY);
172int GetMoverLeft(MOVER *pMover);
173int GetMoverRight(MOVER *pMover);
174int GetMoverTop(MOVER *pMover);
175int GetMoverBottom(MOVER *pMover);
176
177bool MoverIsInPolygon(MOVER *pMover, HPOLYGON hPoly);
178void AlterMover(MOVER *pMover, SCNHANDLE film, AR_FUNCTION fn);
179DIRECTION GetMoverDirection(MOVER *pMover);
180int GetMoverScale(MOVER *pMover);
181void SetMoverDirection(MOVER *pMover, DIRECTION dirn);
182void SetMoverStanding(MOVER *pMover);
183void SetMoverWalkReel(MOVER *pMover, DIRECTION reel, int scale, bool force);
184
185MOVER *InMoverBlock(MOVER *pMover, int x, int y);
186
187void RebootMovers();
188
189bool IsMAinEffectPoly(int index);
190void SetMoverInEffect(int index, bool tf);
191
192void StopMover(MOVER *pMover);
193
194/*----------------------------------------------------------------------*/
195
197
198 int actorID;
199 int objX;
200 int objY;
201 SCNHANDLE hLastfilm;
202
203 SCNHANDLE walkReels[REQ_TOTAL_SCALES][4];
204 SCNHANDLE standReels[REQ_TOTAL_SCALES][4];
205 SCNHANDLE talkReels[REQ_TOTAL_SCALES][4];
206
207 bool bActive;
208 bool bHidden;
209 int brightness;
210 int startColor;
211 int paletteLength;
212};
213
214void SaveMovers(SAVED_MOVER *sMoverInfo);
215void RestoreAuxScales(SAVED_MOVER *sMoverInfo);
216
217MOVER *NextMover(MOVER *pMover);
218
219/*----------------------------------------------------------------------*/
220
221enum {
222 MAGICX = -101,
223 MAGICY = -102
224};
225
226/*----------------------------------------------------------------------*/
227
228} // End of namespace Tinsel
229
230#endif /* TINSEL_MOVERS_H */
Definition: actors.h:36
uint32 SCNHANDLE
Definition: dw.h:31
int HPOLYGON
Definition: dw.h:34
Definition: coroutines.h:300
Definition: anim.h:33
Definition: movers.h:132
Definition: movers.h:50
Definition: object.h:74
Definition: movers.h:196