aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/objects.h
blob: 00eddfdd5e94fa51047f6ec187acea51d64c62e0 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/* 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 HOPKINS_OBJECTS_H
#define HOPKINS_OBJECTS_H

#include "common/scummsys.h"
#include "common/endian.h"
#include "common/str.h"
#include "hopkins/globals.h"

#define MAX_SPRITE 5
namespace Hopkins {

struct SpriteItem {
	int _animationType;
	const byte *_spriteData;
	Common::Point _spritePos;
	int fieldC;
	int fieldE;
	int _spriteIndex;
	int field12;
	int field14;
	byte *field1C;
	int field20;
	int field22;
	int field24;
	int field26;
	bool field28;
	int field2A;
	int field2C;
	int field2E;
	int field30;
	int field32;
	int field34;
	int field36;
};

class HopkinsEngine;

class ObjectsManager {
private:
	HopkinsEngine *_vm;

public:
	SpriteItem _sprite[6];
	bool _priorityFl;
	Common::Point _oldBorderPos; 
	int _oldBorderSpriteIndex;
	Common::Point _borderPos;
	int _borderSpriteIndex;
	int SL_X, SL_Y;
	int I_old_x, I_old_y;
	int g_old_x, g_old_y;
	int FLAG_VISIBLE_EFFACE;
	byte *SL_SPR;
	byte *SL_SPR2;
	byte *_spritePtr;
	const byte *S_old_spr;
	bool PERSO_ON;
	bool SL_FLAG;
	int SL_MODE;
	bool _visibleFl;
	bool _disableCursorFl;
	bool BOBTOUS;
	int my_anim;
	int NUMZONE;
	int ARRET_PERSO_FLAG;
	int ARRET_PERSO_NUM;
	bool _forceZoneFl;
	bool _changeVerbFl;
	int _verb;
	int Vold_taille;
	int SPEED_X, SPEED_Y;
	int SPEED_IMAGE;
	byte *SPEED_PTR;
	int DERLIGNE;
	int A_ANIM;
	int MA_ANIM;
	int MA_ANIM1;
	int A_DEPA;
	int MAX_DEPA;
	int MAX_DEPA1;
	int CH_TETE;
	int T_RECTIF;
	bool DESACTIVE;
	bool DEUXPERSO;
	int PERX, PERY;
	int PERI;
	int RECALL;
	int PTAILLE;
	int PEROFX;
	int PEROFY;
	int OBSSEUL;
	int NVVERBE;
	int NVZONE;
	int S_old_ani;
	int S_old_ret;
	int nouveau_x, nouveau_y;
	int nouveau_sens;
	int nouveau_anim;
public:
	ObjectsManager();
	void setParent(HopkinsEngine *vm);

	void changeObject(int objIndex);
	byte *CAPTURE_OBJET(int objIndex, int mode);
	void removeObject(int objIndex);

	int getWidth(const byte *objectData, int idx);
	int getHeight(const byte *objectData, int idx);
	int sprite_alone(const byte *objectData, byte *sprite, int objIndex);
	void DEL_FICHIER_OBJ();

	byte *loadSprite(const Common::String &file);
	void set_offsetxy(byte *data, int idx, int xp, int yp, bool isSize);
	int get_offsetx(const byte *spriteData, int spriteIndex, bool isSize);
	int get_offsety(const byte *spriteData, int spriteIndex, bool isSize);
	void displaySprite();

	int capture_mem_sprite(const byte *objectData, byte *sprite, int objIndex);
	int addObject(int objIndex);

	void INIT_BOB();
	void BOB_ZERO(int idx);
	void DEF_BOB(int idx);
	void BOB_VISU(int idx);
	void BOB_OFF(int idx);
	void BOB_OFFSET(int idx, int v);
	void BOB_ADJUST(int idx, int v);
	void BOB_OFFSETY(int idx, int v);
	void SCBOB(int idx);
	void CALCUL_BOB(int idx);

	void VERIFCACHE();
	void DEF_SPRITE(int idx);
	void DEF_CACHE(int idx);
	void CALCUL_SPRITE(int idx);
	int AvantTri(TriMode triMode, int index, int priority);
	void AFF_BOB_ANIM();
	void AFF_VBOB();

	int getSpriteX(int idx);
	int getSpriteY(int idx);
	void SPRITE_NOW(const byte *spriteData, int a2, int a3, int a4, int a5, int a6, int a7, int a8);

	void clearSprite();
	void SPRITE_ON(int idx);
	void SPRITE(const byte *spriteData, Common::Point pos, int idx, int spriteIndex, int a6, int a7, int a8, int a9);
	void SPRITE2(const byte *spriteData, int idx, byte *a3, int a4, int a5);
	void removeSprite(int idx);
	void setSpriteX(int idx, int xp);
	void setSpriteIndex(int idx, int spriteIndex);
	void setSpriteY(int idx, int yp);
	void SETTAILLESPR(int idx, int a2);
	void setFlipSprite(int idx, bool flip);

	void VERIFZONE();
	void GOHOME();
	void GOHOME2();
	void CHARGE_OBSTACLE(const Common::String &file);
	void loadZone(const Common::String &file);
	void CARRE_ZONE();
	void PLAN_BETA();
	void handleLeftButton();
	void PARADISE();
	void CLEAR_ECRAN();

	/**
	 * Change the currently active player
	 * @param oldCharacter		Previously played character
	 * @param newCharacter		New character to play
	 */
	void changeCharacterHead(PlayerCharacter oldCharacter, PlayerCharacter newCharacter);

	void VERIFTAILLE();
	void PACOURS_PROPRE(int16 *a1);
	int16 *PARC_VOITURE(int a1, int a2, int a3, int a4);
	void VERBEPLUS();
	void handleRightButton();
	int MZONE();
	void initBorder(int a1);
	void OBJETPLUS(int a1);
	void VALID_OBJET(int a1);
	void OPTI_OBJET();
	void SPECIAL_JEU();
	void BOB_VIVANT(int a1);
	void VBOB(byte *src, int idx, int xp, int yp, int frameIndex);
	void VBOB_OFF(int idx);
	void ACTION_DOS(int idx);
	void ACTION_DROITE(int idx);
	void Q_DROITE(int idx);
	void ACTION_FACE(int idx);
	void Q_GAUCHE(int idx);
	void ACTION_GAUCHE(int idx);

	void ZONE_ON(int idx);
	void ZONE_OFF(int idx);
	void OPTI_ONE(int a1, int a2, int a3, int a4);
	void AFFICHE_SPEED1(byte *speedData, int xp, int yp, int img);
	int BOBPOSI(int idx);
	void BOBANIM_ON(int idx);
	void BOBANIM_OFF(int idx);
	void SET_BOBPOSI(int idx, int a2);
	int BOBX(int idx);
	int BOBY(int idx);
	int BOBA(int idx);

	void INILINK(const Common::String &file);
	void SPECIAL_INI(const Common::String &a1);
	void OPTI_BOBON(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
	void SCI_OPTI_ONE(int a1, int a2, int a3, int a4);
	void VERBE_OFF(int idx, int a2);
	void VERBE_ON(int idx, int a2);
	int CALC_PROPRE(int idx);
	int colision(int xp, int yp);

	void ACTION(const byte *spriteData, const Common::String &a2, int a3, int a4, int a5, int a6);
	void SPACTION(byte *a1, const Common::String &animationSeq, int a3, int a4, int a5, int a6);
	void SPACTION1(byte *a1, const Common::String &a2, int a3, int a4, int a5);
	void TEST_FORET(int a1, int a2, int a3, int a4, int a5, int a6);
	void BLOQUE_ANIMX(int idx, int a2);

	/**
	 * Game scene control method
	 */
	void PERSONAGE(const Common::String &backgroundFile, const Common::String &linkFile,
			const Common::String &animFile, const Common::String &s4, int v);

	/**
	 * Game scene control method
	 */
	void PERSONAGE2(const Common::String &backgroundFile, const Common::String &linkFile,
			const Common::String &animFile, const Common::String &s4, int v);
};

} // End of namespace Hopkins

#endif /* HOPKINS_OBJECTS_H */