aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/sherlock/sherlock_logo.cpp
blob: e27ce765766c3dafe093f4c51c2e703b4a96eed2 (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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/* 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.
 *
 */

#ifdef TSAGE_SHERLOCK_ENABLED
#include "tsage/sherlock/sherlock_logo.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"

namespace TsAGE {

namespace Sherlock {

void SherlockLogo::start() {
	GLOBALS._gfxFontNumber = -1;
	GLOBALS.gfxManager().setDefaults();

	// Start the demo's single scene
	g_globals->_sceneManager.changeScene(1);

	g_globals->_events.setCursor(CURSOR_NONE);
}

Scene *SherlockLogo::createScene(int sceneNumber) {
	// The demo only has a single scene, so ignore the scene number and always return it
	return new SherlockLogoScene();
}

bool SherlockLogo::canLoadGameStateCurrently() {
	return false;
}

bool SherlockLogo::canSaveGameStateCurrently() {
	return false;
}

void SherlockLogo::processEvent(Event &event) {
	if (event.eventType == EVENT_BUTTON_DOWN || (event.eventType == EVENT_KEYPRESS &&
			event.kbd.keycode == Common::KEYCODE_ESCAPE))
		quitGame();
}

void SherlockLogo::quitGame() {
	g_vm->quitGame();
}

/*--------------------------------------------------------------------------*/

void SherlockSceneHandler::postInit(SceneObjectList *OwnerList) {
	_delayTicks = 2;

	GLOBALS._soundManager.postInit();
	GLOBALS._soundManager.buildDriverList(true);
	GLOBALS._soundManager.installConfigDrivers();

	GLOBALS._sceneManager.setNewScene(10);
	GLOBALS._game->start();
}

/*--------------------------------------------------------------------------*/

void Object::setVisage(const Common::String &name) {
	int visageNum = atoi(name.c_str());
	SceneObject::setVisage(visageNum);
}

/*--------------------------------------------------------------------------*/

void SherlockLogoScene::Action1::signal() {
	SherlockLogoScene &scene = *(SherlockLogoScene *)GLOBALS._sceneManager._scene;

	switch (_actionIndex++) {
	case 0:
		// Load scene palette
		GLOBALS._scenePalette.loadPalette(1111);
		GLOBALS._scenePalette.loadPalette(1);
		GLOBALS._scenePalette.refresh();
		setDelay(1);
		break;

	case 1:
		// Fade in the spotlight background
		GLOBALS._scenePalette.addFader(scene._palette1._palette, 256, 6, this);
		break;

	case 2:
		// First half of square, circle, and triangle bouncing
		scene._object1.postInit();
		scene._object1.setVisage("0016.vis");
		scene._object1._strip = 1;
		scene._object1._frame = 1;
		scene._object1.setPosition(Common::Point(169, 107));
		scene._object1.changeZoom(100);
		scene._object1._numFrames = 7;
		scene._object1.animate(ANIM_MODE_5, this);
		break;

	case 3:
		// Remainder of bouncing square, circle, and triangle coming to rest
		scene._object1._strip = 2;
		scene._object1._frame = 1;
		scene._object1.changeZoom(100);
		scene._object1.animate(ANIM_MODE_4, 11, 1, this);
		break;

	case 4:
		// Fade out background without fading out the shapes
		GLOBALS._scenePalette.addFader(scene._palette2._palette, 256, 6, this);
		break;

	case 5:
		scene._backSurface.fillRect(scene._sceneBounds, 0);
		scene._gfxManager2.activate();
		scene._gfxManager2.fillRect(scene._sceneBounds, 0);
		scene._gfxManager2.deactivate();
		//word_2B4AA = 3;
		setDelay(10);
		break;

	case 6:
		GLOBALS._scenePalette.loadPalette(12);
		GLOBALS._scenePalette.refresh();
		setDelay(1);
		break;

	case 7:
		// Animation of shapes expanding upwards to form larger EA logo
		scene._object1.setVisage("0012.vis");
		scene._object1._strip = 1;
		scene._object1._frame = 1;
		scene._object1.changeZoom(100);
		scene._object1.setPosition(Common::Point(170, 142));
		scene._object1._numFrames = 7;
		scene._object1.animate(ANIM_MODE_5, (const void *)nullptr);
		ADD_MOVER(scene._object1, 158, 71);
		break;

	case 8:
		GLOBALS._scenePalette.addFader(scene._palette3._palette, 256, 40, this);
		break;

	case 9:
		// Show 'Electronic Arts' company name
		scene._object2.postInit(nullptr);
		scene._object2.setVisage("0014.vis");
		scene._object2._strip = 1;
		scene._object2._frame = 1;
		scene._object2.setPosition(Common::Point(152, 98));
		scene._object2.changeZoom(100);
		scene._object2.animate(ANIM_MODE_NONE, (const void *)nullptr);
		setDelay(120);
		break;

	case 10:
		// Remainder of steps is positioning and sizing hand cursorin an arc
		scene._object3.postInit();
		scene._object3.setVisage("0018.vis");
		scene._object3._strip = 1;
		scene._object3._frame = 1;
		scene._object3.setPosition(Common::Point(33, 91));
		scene._object3.changeZoom(100);
		scene._object3.animate(ANIM_MODE_NONE, (const void *)nullptr);
		setDelay(5);
		break;

	case 11:
		scene._object3._frame = 2;
		scene._object3.setPosition(Common::Point(44, 124));
		setDelay(5);
		break;

	case 12:
		scene._object3._frame = 3;
		scene._object3.setPosition(Common::Point(64, 153));
		setDelay(5);
		break;

	case 13:
		scene._object3._frame = 4;
		scene._object3.setPosition(Common::Point(87, 174));
		setDelay(5);
		break;

	case 14:
		scene._object3._frame = 5;
		scene._object3.setPosition(Common::Point(114, 191));
		setDelay(5);
		break;

	case 15:
		scene._object3._frame = 6;
		scene._object3.setPosition(Common::Point(125, 184));
		setDelay(5);
		break;

	case 16:
		scene._object3._frame = 7;
		scene._object3.setPosition(Common::Point(154, 187));
		setDelay(5);
		break;

	case 17:
		scene._object3._frame = 8;
		scene._object3.setPosition(Common::Point(181, 182));
		setDelay(5);
		break;

	case 18:
		scene._object3._frame = 9;
		scene._object3.setPosition(Common::Point(191, 167));
		setDelay(5);
		break;

	case 19:
		scene._object3._frame = 10;
		scene._object3.setPosition(Common::Point(190, 150));
		setDelay(5);
		break;

	case 20:
		scene._object3._frame = 11;
		scene._object3.setPosition(Common::Point(182, 139));
		setDelay(5);
		break;

	case 21:
		scene._object3._frame = 11;
		scene._object3.setPosition(Common::Point(170, 130));
		setDelay(5);
		break;

	case 22:
		scene._object3._frame = 11;
		scene._object3.setPosition(Common::Point(158, 121));
		setDelay(8);
		break;

	case 23:
		// Show a highlighting of the company name
		scene._object3.hide();
		scene._object4.show();
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;

	case 24:
		scene._object4._frame = 2;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;

	case 25:
		scene._object2.remove();
		setDelay(1);
		break;

	case 26:
		scene._object4._frame = 3;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;

	case 27:
		scene._object4._frame = 4;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;
		break;

	case 28:
		scene._object4._frame = 5;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;
		break;

	case 29:
		scene._object4._frame = 6;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;
		break;

	case 30:
		scene._object4._frame = 7;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;
		break;

	case 31:
		scene._object4._frame = 8;
		scene._object4.setPosition(Common::Point(155, 94));
		setDelay(8);
		break;

	case 32:
		setDelay(180);
		break;

	default:
		scene.finish();
		remove();
		break;
	}
}

/*--------------------------------------------------------------------------*/

void SherlockLogoScene::postInit(SceneObjectList *OwnerList) {
	loadScene(10);
	Scene::postInit(OwnerList);

	_palette1.loadPalette(1111);
	_palette1.loadPalette(10);
	_palette2.loadPalette(1111);
	_palette2.loadPalette(1);
	_palette3.loadPalette(1111);
	_palette3.loadPalette(14);

	_object4.postInit();
	_object4.setVisage("0019.vis");
	_object4._strip = 1;
	_object4._frame = 1;
	_object4.setPosition(Common::Point(155, 94));
	_object4.changeZoom(100);
	_object4.animate(ANIM_MODE_NONE, (const void *)nullptr);
	_object4.hide();

	setAction(&_action1);
}

void SherlockLogoScene::finish() {
	g_vm->quitGame();
}

} // End of namespace Sherlock

} // End of namespace TsAGE

#endif