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 
30 namespace Tinsel {
31 
32 struct OBJECT;
33 
34 enum NPS {NOT_IN, GOING_UP, GOING_DOWN, LEAVING, ENTERING};
35 
36 enum IND {NO_PROB, TRY_CENTER, TRY_CORNER, TRY_NEXTCORNER};
37 
38 enum 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 
48 enum MOVER_TYPE { MOVER_2D, MOVER_3D };
49 
50 struct 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;
58  HPOLYGON hUpath;
59  HPOLYGON hCpath;
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, just for 3D actors
123  MOVER_TYPE type;
124  SCNHANDLE hModelName;
125  SCNHANDLE hTextureName;
126  bool bIsValid;
127 
128 };
129 
130 struct MAINIT {
131  int X;
132  int Y;
133  MOVER *pMover;
134 };
135 
136 //---------------------------------------------------------------------------
137 
138 
139 void MoverProcessCreate(int X, int Y, int id, MOVER *pMover);
140 
141 
142 enum AR_FUNCTION { AR_NORMAL, AR_PUSHREEL, AR_POPREEL, AR_WALKREEL };
143 
144 void StoreMoverPalette(MOVER *pMover, int startColor, int length);
145 
146 void MoverBrightness(MOVER *pMover, int brightness);
147 
148 MOVER *GetMover(int ano);
149 MOVER *RegisterMover(int ano);
150 void KillMover(MOVER *pMover);
151 MOVER *GetLiveMover(int index);
152 
153 bool getMActorState(MOVER *psActor);
154 int GetMoverId(MOVER *pMover);
155 void SetMoverZ(MOVER *pMover, int y, uint32 zFactor);
156 void SetMoverZoverride(MOVER *pMover, uint32 zFactor);
157 
158 void HideMover(MOVER *pMover, int sf = 0);
159 bool MoverHidden(MOVER *pMover);
160 bool MoverIs(MOVER *pMover);
161 bool MoverIsSWalking(MOVER *pMover);
162 bool MoverMoving(MOVER *pMover);
163 int GetWalkNumber(MOVER *pMover);
164 void UnHideMover(MOVER *pMover);
165 void DropMovers();
166 void PositionMover(MOVER *pMover, int x, int y);
167 
168 void GetMoverPosition(MOVER *pMover, int *aniX, int *aniY);
169 void GetMoverMidTop(MOVER *pMover, int *aniX, int *aniY);
170 int GetMoverLeft(MOVER *pMover);
171 int GetMoverRight(MOVER *pMover);
172 int GetMoverTop(MOVER *pMover);
173 int GetMoverBottom(MOVER *pMover);
174 
175 bool MoverIsInPolygon(MOVER *pMover, HPOLYGON hPoly);
176 void AlterMover(MOVER *pMover, SCNHANDLE film, AR_FUNCTION fn);
177 DIRECTION GetMoverDirection(MOVER *pMover);
178 int GetMoverScale(MOVER *pMover);
179 void SetMoverDirection(MOVER *pMover, DIRECTION dirn);
180 void SetMoverStanding(MOVER *pMover);
181 void SetMoverWalkReel(MOVER *pMover, DIRECTION reel, int scale, bool force);
182 
183 MOVER *InMoverBlock(MOVER *pMover, int x, int y);
184 
185 void RebootMovers();
186 
187 bool IsMAinEffectPoly(int index);
188 void SetMoverInEffect(int index, bool tf);
189 
190 void StopMover(MOVER *pMover);
191 
192 /*----------------------------------------------------------------------*/
193 
194 struct SAVED_MOVER {
195 
196  int actorID;
197  int objX;
198  int objY;
199  SCNHANDLE hLastfilm;
200 
201  SCNHANDLE walkReels[REQ_TOTAL_SCALES][4];
202  SCNHANDLE standReels[REQ_TOTAL_SCALES][4];
203  SCNHANDLE talkReels[REQ_TOTAL_SCALES][4];
204 
205  bool bActive;
206  bool bHidden;
207  int brightness;
208  int startColor;
209  int paletteLength;
210 };
211 
212 void SaveMovers(SAVED_MOVER *sMoverInfo);
213 void RestoreAuxScales(SAVED_MOVER *sMoverInfo);
214 
215 MOVER *NextMover(MOVER *pMover);
216 
217 /*----------------------------------------------------------------------*/
218 
219 enum {
220  MAGICX = -101,
221  MAGICY = -102
222 };
223 
224 /*----------------------------------------------------------------------*/
225 
226 } // End of namespace Tinsel
227 
228 #endif /* TINSEL_MOVERS_H */
uint32 SCNHANDLE
Definition: dw.h:31
Definition: movers.h:194
Definition: anim.h:33
Definition: movers.h:130
Definition: movers.h:50
Definition: object.h:73
Definition: coroutines.h:300
Definition: actors.h:36
int HPOLYGON
Definition: dw.h:34