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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * Prototypes of actor functions
22  */
23 
24 #ifndef TINSEL_ACTOR_H	// prevent multiple includes
25 #define TINSEL_ACTOR_H
26 
27 
28 #include "tinsel/dw.h"		// for SCNHANDLE
29 #include "tinsel/events.h"	// for TINSEL_EVENT
30 #include "tinsel/palette.h"	// for COLORREF
31 
32 namespace Tinsel {
33 
34 struct FREEL;
35 struct INT_CONTEXT;
36 struct MOVER;
37 struct OBJECT;
38 
39 #define ACTORTAG_KEY 0x1000000
40 
41 #define OTH_RELATEDACTOR	0x00000fff
42 #define OTH_RELATIVE		0x00001000
43 #define OTH_ABSOLUTE		0x00002000
44 
45 /*----------------------------------------------------------------------*/
46 
47 void RegisterActors(int num);
48 void FreeActors();
49 void SetLeadId(int rid);
50 int GetLeadId();
51 bool ActorIsGhost(int actor);
52 void StartTaggedActors(SCNHANDLE ah, int numActors, bool bRunScript);
53 void DropActors();		// No actor reels running
54 void DisableActor(int actor);
55 void EnableActor(int actor);
56 void Tag_Actor(int ano, SCNHANDLE tagtext, int tp);
57 void UnTagActor(int ano);
58 void ReTagActor(int ano);
59 int TagType(int ano);
60 bool actorAlive(int ano);
61 int32 actorMaskType(int ano);
62 void GetActorPos(int ano, int *x, int *y);
63 void SetActorPos(int ano, int x, int y);
64 void GetActorMidTop(int ano, int *x, int *y);
65 int GetActorLeft(int ano);
66 int GetActorRight(int ano);
67 int GetActorTop(int ano);
68 int GetActorBottom(int ano);
69 void ShowActor(CORO_PARAM, int ano);
70 void HideActor(CORO_PARAM, int ano);
71 bool ActorHidden(int ano);
72 bool HideMovingActor(int id, int sf);
73 void unHideMovingActor(int id);
74 void restoreMovement(int id);
75 void storeActorReel(int ano, const FREEL *reel, SCNHANDLE hFilm, OBJECT *pobj, int reelnum, int x, int y);
76 const FREEL *actorReel(int ano);
77 SCNHANDLE actorFilm(int ano);
78 
79 void SetActorPlayFilm(int ano, SCNHANDLE hFilm);
80 SCNHANDLE GetActorPlayFilm(int ano);
81 void SetActorTalkFilm(int ano, SCNHANDLE hFilm);
82 SCNHANDLE GetActorTalkFilm(int ano);
83 void SetActorTalking(int ano, bool tf);
84 bool ActorIsTalking(int ano);
85 void SetActorLatestFilm(int ano, SCNHANDLE hFilm);
86 SCNHANDLE GetActorLatestFilm(int ano);
87 
88 void UpdateActorEsc(int ano, bool escOn, int escEvent);
89 void UpdateActorEsc(int ano, int escEvent);
90 bool ActorEsc(int ano);
91 int ActorEev(int ano);
92 void StoreActorPos(int ano, int x, int y);
93 void StoreActorSteps(int ano, int steps);
94 int GetActorSteps(int ano);
95 void StoreActorZpos(int ano, int z, int column = -1);
96 int GetActorZpos(int ano, int column);
97 void IncLoopCount(int ano);
98 int GetLoopCount(int ano);
99 SCNHANDLE GetActorTag(int ano);
100 void FirstTaggedActor();
101 int NextTaggedActor();
102 int NextTaggedActor(int previous);
103 int AsetZPos(OBJECT *pObj, int y, int32 zFactor);
104 void SetMoverZ(MOVER *pMover, int y, int32 zFactor);
105 void ActorEvent(int ano, TINSEL_EVENT event, PLR_EVENT be);
106 
107 void storeActorAttr(int ano, int r1, int g1, int b1);
108 COLORREF GetActorRGB(int ano);
109 void SetActorRGB(int ano, COLORREF color);
110 void SetActorZfactor(int ano, uint32 zFactor);
111 uint32 GetActorZfactor(int ano);
112 
113 void setactorson();
114 
115 void ActorsLife(int id, bool bAlive);
116 
117 void dwEndActor(int ano);
118 
119 void ActorEvent(CORO_PARAM, int ano, TINSEL_EVENT tEvent, bool bWait, int myEscape, bool *result = NULL);
120 
121 void GetActorTagPortion(int ano, unsigned *top, unsigned *bottom, unsigned *left, unsigned *right);
122 SCNHANDLE GetActorTagHandle(int ano);
123 void SetActorPointedTo(int actor, bool bPointedTo);
124 bool ActorIsPointedTo(int actor);
125 void SetActorTagWanted(int actor, bool bTagWanted, bool bCursor, SCNHANDLE hOverrideTag);
126 bool ActorTagIsWanted(int actor);
127 bool InHotSpot(int ano, int curX, int curY);
128 int FrontTaggedActor();
129 void GetActorTagPos(int actor, int *pTagX, int *pTagY, bool bAbsolute);
130 bool IsTaggedActor(int actor);
131 void StoreActorPresFilm(int ano, SCNHANDLE hFilm, int x, int y);
132 SCNHANDLE GetActorPresFilm(int ano);
133 int GetActorFilmNumber(int ano);
134 void StoreActorReel(int actor, int column, OBJECT *pObj);
135 void NotPlayingReel(int actor, int filmNumber, int column);
136 bool ActorReelPlaying(int actor, int column);
137 
138 /*----------------------------------------------------------------------*/
139 
140 struct SAVED_ACTOR {
141 	short		actorID;
142 	short		zFactor;
143 	bool		bAlive;
144 	bool		bHidden;
145 	SCNHANDLE	presFilm;	///< the film that reel belongs to
146 	short		presRnum;	///< the present reel number
147 	short		presPlayX, presPlayY;
148 };
149 typedef SAVED_ACTOR *PSAVED_ACTOR;
150 
151 #define NUM_ZPOSITIONS	200	// Reasonable-sounding number
152 
153 struct Z_POSITIONS {
154 	short	actor;
155 	short	column;
156 	int		z;
157 };
158 
159 void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag);
160 
161 int SaveActors(PSAVED_ACTOR sActorInfo);
162 void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo);
163 
164 void SaveZpositions(void *zpp);
165 void RestoreZpositions(void *zpp);
166 
167 void SaveActorZ(byte *saveActorZ);
168 void RestoreActorZ(byte *saveActorZ);
169 
170 /*----------------------------------------------------------------------*/
171 
172 } // End of namespace Tinsel
173 
174 #endif /* TINSEL_ACTOR_H */
175