aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/tattoo/tattoo_map.cpp
blob: 72834285cf51555bb23e06be8dc981626f8283c5 (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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
/* 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.
 *
 */

#include "sherlock/tattoo/tattoo_map.h"
#include "sherlock/tattoo/tattoo_scene.h"
#include "sherlock/tattoo/tattoo.h"

namespace Sherlock {

namespace Tattoo {

#define MAP_NAME_COLOR 131
#define CLOSEUP_STEPS 30
#define SCROLL_SPEED 16

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

void MapEntry::clear() {
	_iconNum = -1;
	_description = "";
}

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

TattooMap::TattooMap(SherlockEngine *vm) : Map(vm) {
	_iconImages = nullptr;
	_bgFound = _oldBgFound = 0;
	_textBuffer = nullptr;

	loadData();
}

int TattooMap::show() {
	Events &events = *_vm->_events;
	Music &music = *_vm->_music;
	Resources &res = *_vm->_res;
	TattooScene &scene = *(TattooScene *)_vm->_scene;
	Screen &screen = *_vm->_screen;
	int result = 0;

	// Check if we need to keep track of how many times player has been to the map
	for (uint idx = 0; idx < scene._sceneTripCounters.size(); ++idx) {
		SceneTripEntry &entry = scene._sceneTripCounters[idx];

		if (entry._sceneNumber == OVERHEAD_MAP || entry._sceneNumber == OVERHEAD_MAP2) {
			if (--entry._numTimes == 0) {
				_vm->setFlagsDirect(entry._flag);
				scene._sceneTripCounters.remove_at(idx);
			}
		}
	}

	if (music._midiOption) {
		// See if Holmes or Watson is the active character	
		Common::String song;
		if (_vm->readFlags(76))
			// Player is Holmes
			song = "Cue9";
		else if (_vm->readFlags(525))
			song = "Cue8";
		else
			song = "Cue7";

		if (music.loadSong(song)) {
			music.setMIDIVolume(music._musicVolume);
			if (music._musicOn)
				music.startSong();
		}
	}

	screen.initPaletteFade(1364485);
	
	// Load the custom mouse cursors for the map
	ImageFile cursors("omouse.vgs");
	events.setCursor(cursors[0]._frame);

	// Load the data for the map
	_iconImages = new ImageFile("mapicons.vgs");
	loadData();

	// Load the palette
	Common::SeekableReadStream *stream = res.load("map.pal");
	stream->read(screen._cMap, PALETTE_SIZE);
	screen.translatePalette(screen._cMap);
	delete stream;

	// Load the map image and draw it to the back buffer
	ImageFile *map = new ImageFile("map.vgs");
	screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2, _vm->getPlatform());
	screen._backBuffer1.blitFrom((*map)[0], Common::Point(0, 0));
	delete map;

	screen.clear();
	screen.setPalette(screen._cMap);
	drawMapIcons();

	// Copy the map drawn in the back buffer to the secondary back buffer
	screen._backBuffer2.create(SHERLOCK_SCREEN_WIDTH * 2, SHERLOCK_SCREEN_HEIGHT * 2, _vm->getPlatform());
	screen._backBuffer2.blitFrom(screen._backBuffer1);

	// Display the built map to the screen
	screen.slamArea(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT);

	// Set text display positioning and scroll position
	_oldTextBounds.left = _oldTextBounds.top = _oldTextBounds.right = _oldTextBounds.bottom = 0;
	_textBounds.left = _textBounds.top = _textBounds.right = _textBounds.bottom = 0;
	_targetScroll = _bigPos;
	_currentScroll = Common::Point(-1, -1);

	do {
		// Allow for event processing and get the current mouse position
		events.pollEventsAndWait();
		events.setButtonState();
		Common::Point mousePos = events.mousePos();

		checkMapNames(true);

		if (mousePos.x < (SHERLOCK_SCREEN_WIDTH / 6))
			_targetScroll.x -= 2 * SCROLL_SPEED * (SHERLOCK_SCREEN_WIDTH / 6 - mousePos.x) / (SHERLOCK_SCREEN_WIDTH / 6);
		if (mousePos.x > (SHERLOCK_SCREEN_WIDTH * 5 / 6))
			_targetScroll.x += 2 * SCROLL_SPEED * (mousePos.x - (SHERLOCK_SCREEN_WIDTH * 5 / 6)) / (SHERLOCK_SCREEN_WIDTH / 6);
		if (mousePos.y < (SHERLOCK_SCREEN_HEIGHT / 6))
			_targetScroll.y -= 2 * SCROLL_SPEED * (SHERLOCK_SCREEN_HEIGHT / 6 - mousePos.y) / (SHERLOCK_SCREEN_HEIGHT / 6);
		if (mousePos.y > (SHERLOCK_SCREEN_HEIGHT * 5 / 6))
			_targetScroll.y += 2 * SCROLL_SPEED * (mousePos.y - SHERLOCK_SCREEN_HEIGHT * 5 / 6) / (SHERLOCK_SCREEN_HEIGHT / 6);

		if (_targetScroll.x < 0)
			_targetScroll.x = 0;
		if ((_targetScroll.x + SHERLOCK_SCREEN_WIDTH) > screen._backBuffer1.w())
			_targetScroll.x = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH;
		if (_targetScroll.y < 0)
			_targetScroll.y = 0;
		if ((_targetScroll.y + SHERLOCK_SCREEN_HEIGHT) > screen._backBuffer1.h())
			_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT;

		// Check the keyboard
		if (events.kbHit()) {
			Common::KeyState keyState = events.getKey();

			switch (keyState.keycode) {
			case Common::KEYCODE_HOME:
			case Common::KEYCODE_KP7:
				_targetScroll.x = 0;
				_targetScroll.y = 0;
				break;

			case Common::KEYCODE_END:
			case Common::KEYCODE_KP1:
				_targetScroll.x = screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH;
				_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT;
				break;

			case Common::KEYCODE_PAGEUP:
			case Common::KEYCODE_KP9:
				_targetScroll.y -= SHERLOCK_SCREEN_HEIGHT;
				if (_targetScroll.y < 0)
					_targetScroll.y = 0;
				break;

			case Common::KEYCODE_PAGEDOWN:
			case Common::KEYCODE_KP3:
				_targetScroll.y += SHERLOCK_SCREEN_HEIGHT;
				if (_targetScroll.y > (screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT))
					_targetScroll.y = screen._backBuffer1.h() - SHERLOCK_SCREEN_HEIGHT;
				break;

			case Common::KEYCODE_SPACE:
				events._pressed = false;
				events._oldButtons = 0;
				events._released = true;
				break;

			default:
				break;
			}
		}

		// Handle any scrolling of the map
		if (_currentScroll != _targetScroll) {
			// If there is a Text description being displayed, restore the area under it
			if (_oldTextBounds.width() > 0)
				screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldTextBounds.left, 
					_oldTextBounds.top), _oldTextBounds);

			_currentScroll = _targetScroll;

			checkMapNames(false);
			slamRect(Common::Rect(_currentScroll.x, _currentScroll.y, _currentScroll.x + SHERLOCK_SCREEN_WIDTH, 
				_currentScroll.y + SHERLOCK_SCREEN_HEIGHT));
		}

		// Handling if a location has been clicked on
		if (events._released && _bgFound != -1) {
			// If there is a Text description being displayed, restore the area under it
			if (_oldTextBounds.width() > 0) {
				screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldTextBounds.left,
					_oldTextBounds.top), _oldTextBounds);
				screen.slamRect(_oldTextBounds);
			}

			// Save the current scroll position on the map
			_bigPos = _currentScroll;

			showCloseUp(_bgFound);
			result = _bgFound + 1;
		}
	} while (!result && !_vm->shouldQuit());

	music.stopMusic();
	events.clearEvents();
	delete _textBuffer;
	_textBuffer = nullptr;

	// Reset the back buffers back to standard size
	screen._backBuffer1.create(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT, _vm->getPlatform());
	screen._backBuffer2.create(SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT, _vm->getPlatform());

	return result;
}

void TattooMap::loadData() {
	Resources &res = *_vm->_res;
	char c;

	Common::SeekableReadStream *stream = res.load("map.txt");

	_data.resize(100);
	for (uint idx = 0; idx < _data.size(); ++idx)
		_data[idx].clear();

	do
	{
		// Find the start of the number
		do {
			c = stream->readByte();
			if (stream->pos() >= stream->size())
				return;
		} while (c < '0' || c > '9');

		// Get the scene number
		Common::String locStr;
		locStr += c;
		while ((c = stream->readByte()) != '.')
			locStr += c;
		MapEntry &mapEntry = _data[atoi(locStr.c_str()) - 1];

		// Get the location name
		while (stream->readByte() != '"')
			;

		while ((c = stream->readByte()) != '"')
			mapEntry._description += c;

		// Find the ( specifying the (X,Y) position of the Icon
		while (stream->readByte() != '(')
			;

		// Get the X Position of the icon
		Common::String numStr;
		while ((c = stream->readByte()) != ',')
			numStr += c;
		mapEntry.x = atoi(numStr.c_str());

		// Get the Y position of the icon
		numStr = "";
		while ((c = stream->readByte()) != ')')
			numStr += c;
		mapEntry.y = atoi(numStr.c_str());

		// Find and get the location's icon number
		while (stream->readByte() != '#')
			;

		Common::String iconStr;
		while (stream->pos() < stream->size() && (c = stream->readByte()) != '\r')
			iconStr += c;

		mapEntry._iconNum = atoi(iconStr.c_str()) - 1;
	} while (stream->pos() < stream->size());

	delete stream;
}

void TattooMap::drawMapIcons() {
	Screen &screen = *_vm->_screen;
	
	for (uint idx = 0; idx < _data.size(); ++idx) {
		_vm->setFlagsDirect(idx + 1); //***DEBUG***
		if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) {
			MapEntry &mapEntry = _data[idx];
			ImageFrame &img = (*_iconImages)[mapEntry._iconNum];
			screen._backBuffer1.transBlitFrom(img._frame, Common::Point(mapEntry.x - img._width / 2,
				mapEntry.y - img._height / 2));
		}
	}
}

void TattooMap::checkMapNames(bool slamIt) {
	Events &events = *_vm->_events;
	Screen &screen = *_vm->_screen;
	Common::Point mousePos = events.mousePos() + _currentScroll;

	// See if the mouse is pointing at any of the map locations
	_bgFound = -1;

	for (uint idx = 0; idx < _data.size(); ++idx) {
		if (_data[idx]._iconNum != -1 && _vm->readFlags(idx + 1)) {
			MapEntry &mapEntry = _data[idx];
			ImageFrame &img = (*_iconImages)[mapEntry._iconNum];
			Common::Rect r(mapEntry.x - img._width / 2, mapEntry.y - img._height / 2,
				mapEntry.x + img._width / 2, mapEntry.y + img._height / 2);

			if (r.contains(mousePos)) {
				_bgFound = idx;
				break;
			}
		}
	}

	// Store the previous bounds that were drawn
	_oldTextBounds = _textBounds;

	// See if thay are pointing at a different location and we need to change the display
	if (_bgFound != _oldBgFound || (_bgFound != -1 && _textBuffer == nullptr)) {
		// See if there is a new image to be displayed
		if (_bgFound != -1 && (_bgFound != _oldBgFound || _textBuffer == nullptr)) {
			const Common::String &desc = _data[_bgFound]._description;
			const char *space = nullptr;
			int width = screen.stringWidth(desc) + 2;
			int height = 0;

			// See if we need to split it into two lines
			if (width > 150) {
				const char *s = desc.c_str();

				int dif = 10000;
				for (;;) {
					// Move to end of next word
					s = strchr(s, ' ');

					if (s == nullptr) {
						// Reached end of description
						if (space == nullptr) {
							height = screen.stringHeight(desc) + 2;
						} else {
							Common::String line1(desc.c_str(), space);
							Common::String line2(space + 1);

							height = screen.stringHeight(line1) + screen.stringHeight(line2);
						}
						break;
					} else {
						// Reached space separating words within the description
						// Get width before and after word
						int width1 = screen.stringWidth(Common::String(desc.c_str(), s));
						int width2 = screen.stringWidth(Common::String(s + 1));

						if (ABS(width1 - width2) < dif) {
							space = s;
							dif = ABS(width1 - width2);
							width = MAX(width1, width) + 2;
						}

						++s;
					}
				}
			} else {
				height = screen.stringHeight(desc) + 2;
			}

			// Delete any previous saved area
			delete _textBuffer;

			// Allocate a new surface
			_textBuffer = new Surface(width, height, _vm->getPlatform());

			_textBuffer->fillRect(Common::Rect(0, 0, width, height), TRANSPARENCY);
			if (space == nullptr) {
				// The whole text can be drawn on a single line
				_textBuffer->writeString(desc, Common::Point(0, 0), BLACK);
				_textBuffer->writeString(desc, Common::Point(1, 0), BLACK);
				_textBuffer->writeString(desc, Common::Point(2, 0), BLACK);
				_textBuffer->writeString(desc, Common::Point(0, 1), BLACK);
				_textBuffer->writeString(desc, Common::Point(2, 1), BLACK);
				_textBuffer->writeString(desc, Common::Point(0, 2), BLACK);
				_textBuffer->writeString(desc, Common::Point(1, 2), BLACK);
				_textBuffer->writeString(desc, Common::Point(2, 2), BLACK);
				_textBuffer->writeString(desc, Common::Point(1, 1), MAP_NAME_COLOR);
			} else {
				// The text needs to be split up over two lines
				Common::String line1(desc.c_str(), space);
				Common::String line2(space + 1);

				// Draw the first line
				int xp = (width - screen.stringWidth(desc)) / 2;
				_textBuffer->writeString(line1, Common::Point(xp + 0, 0), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 1, 0), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 2, 0), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 0, 1), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 2, 1), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 0, 2), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 1, 2), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 2, 2), BLACK);
				_textBuffer->writeString(line1, Common::Point(xp + 1, 1), MAP_NAME_COLOR);

				int yp = screen.stringHeight(line2);
				xp = (width - screen.stringWidth(line2)) / 2;
				// CHECKME: Shouldn't we use yp for drawing line2?
				_textBuffer->writeString(line2, Common::Point(xp + 0, yp), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 1, yp), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 2, yp), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 0, yp + 1), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 2, yp + 1), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 0, yp + 2), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 1, yp + 2), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 2, yp + 2), BLACK);
				_textBuffer->writeString(line2, Common::Point(xp + 1, yp + 1), MAP_NAME_COLOR);
			}

			// Set the text display position
			setTextBounds();
		} else if (_bgFound == -1 && _oldBgFound != -1) {
			// We need to clear a currently displayed name
			delete _textBuffer;
			_textBuffer = nullptr;
		}
	
		_oldBgFound = _bgFound;
	} else {
		// Set the new text position
		setTextBounds();
	}

	// If the location name was displayed, restore the graphics underneath where it previously was
	if (_oldTextBounds.width() > 0)
		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldTextBounds.left, _oldTextBounds.top), _oldTextBounds);

	// See if we need to draw the currently highlighted location name
	if (_textBuffer != nullptr)
		screen._backBuffer1.transBlitFrom(*_textBuffer, Common::Point(_textBounds.left, _textBounds.top));

	// See if we need to flush the areas associated with the text
	if (_oldTextBounds.width() > 0) {
		if (slamIt)
			slamRect(_oldTextBounds);

		// If there's no text to display, reset the display bounds
		if (_textBuffer == nullptr) {
			_textBounds.left = _textBounds.top = _textBounds.right = _textBounds.bottom = 0;
			_oldTextBounds.left = _oldTextBounds.top = _oldTextBounds.right = _oldTextBounds.bottom = 0;
		}
	}

	// If there's text to display, then copy the drawn area to the screen
	if (_textBuffer != nullptr && slamIt)
		slamRect(_textBounds);
}

void TattooMap::setTextBounds() {
	Events &events = *_vm->_events;
	Common::Point mousePos = events.mousePos();

	if (_textBuffer == nullptr) {
		_textBounds = Common::Rect(0, 0, 0, 0);
	} else {
		int xp = (mousePos.x - _textBounds.width() / 2) + _currentScroll.x;
		int yp = (mousePos.y - _textBounds.height() / 2) + _currentScroll.y;
		if (xp < _currentScroll.x)
			xp = _currentScroll.x;
		if ((xp + _textBounds.width()) >(_currentScroll.x + SHERLOCK_SCREEN_WIDTH))
			xp = _currentScroll.x + SHERLOCK_SCREEN_WIDTH - _textBounds.width();
		if (yp < _currentScroll.y)
			yp = _currentScroll.y;
		if ((yp + _textBounds.height()) >(_currentScroll.y + SHERLOCK_SCREEN_HEIGHT))
			yp = _currentScroll.y + SHERLOCK_SCREEN_HEIGHT - _textBounds.height();

		_textBounds = Common::Rect(xp, yp, xp + _textBuffer->w(), yp + _textBuffer->h());
	}
}

void TattooMap::restoreArea(const Common::Rect &bounds) {
	Screen &screen = *_vm->_screen;

	Common::Rect r = bounds;
	r.clip(Common::Rect(0, 0, screen._backBuffer1.w(), screen._backBuffer1.h()));

	if (!r.isEmpty())
		screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(r.left, r.top), r);
}

void TattooMap::showCloseUp(int closeUpNum) {
	Events &events = *_vm->_events;
	Screen &screen = *_vm->_screen;

	// Get the closeup images
	Common::String fname = Common::String::format("res%02d.vgs", closeUpNum + 1);
	ImageFile pic(fname);

	Point32 closeUp(_data[closeUpNum].x * 100, _data[closeUpNum].y * 100);
	Point32 delta((SHERLOCK_SCREEN_WIDTH / 2 - closeUp.x / 100) * 100 / CLOSEUP_STEPS,
		(SHERLOCK_SCREEN_HEIGHT / 2 - closeUp.y / 100) * 100 / CLOSEUP_STEPS);
	Common::Rect oldBounds(closeUp.x / 100, closeUp.y / 100, closeUp.x / 100 + 1, closeUp.y / 100 + 1);
	int size = 64;
	int n = 256;
	int deltaVal = 512;
	bool minimize = false;
	int scaleVal, newSize;

	do {
		scaleVal = n;
		newSize = pic[0].sDrawXSize(n);

		if (newSize > size) {
			if (minimize)
				deltaVal /= 2;
			n += deltaVal;
		} else {
			minimize = true;
			deltaVal /= 2;
			n -= deltaVal;
			if (n < 1)
				n = 1;
		}
	} while (deltaVal && size != newSize);

	int deltaScale = (SCALE_THRESHOLD - scaleVal) / CLOSEUP_STEPS;

	for (int step = 0; step < CLOSEUP_STEPS; ++step) {
		Common::Point picSize(pic[0].sDrawXSize(scaleVal), pic[0].sDrawYSize(scaleVal));
		Common::Point pt(closeUp.x / 100 - picSize.x / 2, closeUp.y / 100 - picSize.y / 2);

		restoreArea(oldBounds);
		screen._backBuffer1.transBlitFrom(pic[0], pt, false, 0, scaleVal);

		screen.slamRect(oldBounds);
		screen.slamArea(pt.x, pt.y, picSize.x, picSize.y);

		oldBounds = Common::Rect(pt.x, pt.y, pt.x + picSize.x + 1, pt.y + picSize.y + 1);
		closeUp += delta;
		scaleVal += deltaScale;

		events.wait(1);
	}

	// Handle final drawing of closeup
	// TODO: Handle scrolling
	Common::Rect r(SHERLOCK_SCREEN_WIDTH / 2 - pic[0]._width / 2, SHERLOCK_SCREEN_HEIGHT / 2 - pic[0]._height / 2,
		SHERLOCK_SCREEN_WIDTH / 2 - pic[0]._width / 2 + pic[0]._width,
		SHERLOCK_SCREEN_HEIGHT / 2 - pic[0]._height / 2 + pic[0]._height);

	restoreArea(oldBounds);
	screen._backBuffer1.transBlitFrom(pic[0], Common::Point(r.left, r.top));
	screen.slamRect(oldBounds);
	screen.slamRect(r);
	events.wait(2);
}

void TattooMap::slamRect(const Common::Rect &bounds) {
	Screen &screen = *_vm->_screen;
	Common::Rect r = bounds;
	r.translate(-_currentScroll.x, -_currentScroll.y);

	screen.blitFrom(screen._backBuffer1, Common::Point(r.left, r.top), bounds);
}

} // End of namespace Tattoo

} // End of namespace Sherlock