[Scummvm-cvs-logs] scummvm master -> 1c44fa5bbc5f91f0c48696c66b65d117457b2ec8
wjp
wjp at usecode.org
Wed Jun 10 07:21:41 CEST 2015
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dd116cfbf0 SHERLOCK: Add RT map data loading
e670951a46 SCUMM: Fix bug #6592 SCUMM: ZAK - Read Ticket is too fast to read.
15b9d61f6e SHERLOCK: adjust "early following morning" coords
866d7a27d8 SHERLOCK: 3DO intro: implement fade in/out/merge
6aaee559dc SHERLOCK: 3DO intro: implement fade from white
ce6ad7e6d8 SHERLOCK: Fix tiny memory leak
256158cbe2 SHERLOCK: free midi music buffer
1c44fa5bbc Merge branch 'master' of github.com:scummvm/scummvm
Commit: dd116cfbf01b87c201249d98b2384e2671ff04bf
https://github.com/scummvm/scummvm/commit/dd116cfbf01b87c201249d98b2384e2671ff04bf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-10T07:12:25+02:00
Commit Message:
SHERLOCK: Add RT map data loading
Changed paths:
engines/sherlock/tattoo/tattoo_map.cpp
engines/sherlock/tattoo/tattoo_map.h
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index ced7ed9..3a02d5b 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -21,16 +21,89 @@
*/
#include "sherlock/tattoo/tattoo_map.h"
+#include "sherlock/sherlock.h"
namespace Sherlock {
namespace Tattoo {
+void MapEntry::clear() {
+ _iconNum = -1;
+ _description = "";
+}
+
+/*-------------------------------------------------------------------------*/
+
+TattooMap::TattooMap(SherlockEngine *vm) : Map(vm) {
+ loadData();
+}
+
int TattooMap::show() {
// TODO
return 61;
}
+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());
+}
+
} // End of namespace Tattoo
} // End of namespace Sherlock
diff --git a/engines/sherlock/tattoo/tattoo_map.h b/engines/sherlock/tattoo/tattoo_map.h
index 750cd90..b0c1a3f 100644
--- a/engines/sherlock/tattoo/tattoo_map.h
+++ b/engines/sherlock/tattoo/tattoo_map.h
@@ -32,9 +32,25 @@ class SherlockEngine;
namespace Tattoo {
+struct MapEntry : Common::Point {
+ int _iconNum;
+ Common::String _description;
+
+ MapEntry() : Common::Point(), _iconNum(-1) {}
+ MapEntry(int posX, int posY, int iconNum) : Common::Point(posX, posY), _iconNum(iconNum) {}
+ void clear();
+};
+
class TattooMap : public Map {
+private:
+ Common::Array<MapEntry> _data;
+
+ /**
+ * Load data needed for the map
+ */
+ void loadData();
public:
- TattooMap(SherlockEngine *vm) : Map(vm) {}
+ TattooMap(SherlockEngine *vm);
virtual ~TattooMap() {}
/**
Commit: e670951a469b33e28bc9352f8417ba42868468a8
https://github.com/scummvm/scummvm/commit/e670951a469b33e28bc9352f8417ba42868468a8
Author: Kirben (kirben at optusnet.com.au)
Date: 2015-06-10T07:12:25+02:00
Commit Message:
SCUMM: Fix bug #6592 SCUMM: ZAK - Read Ticket is too fast to read.
Changed paths:
engines/scumm/scumm.cpp
engines/scumm/scumm.h
engines/scumm/string.cpp
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 99b4e69..c2e0cb2 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -316,6 +316,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_NES_lastTalkingActor = 0;
_NES_talkColor = 0;
_keepText = false;
+ _msgCount = 0;
_costumeLoader = NULL;
_costumeRenderer = NULL;
_2byteFontPtr = 0;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 30b4d61..6e0adc3 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1182,6 +1182,7 @@ protected:
byte _charsetBuffer[512];
bool _keepText;
+ byte _msgCount;
int _nextLeft, _nextTop;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index d60c4c6..3049fbc 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -283,6 +283,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
switch (c) {
case 1:
c = 13; // new line
+ _msgCount = _screenWidth;
endLoop = true;
break;
case 2:
@@ -293,6 +294,7 @@ bool ScummEngine::handleNextCharsetCode(Actor *a, int *code) {
case 3:
_haveMsg = (_game.version >= 7) ? 1 : 0xFF;
_keepText = false;
+ _msgCount = 0;
endLoop = true;
break;
case 8:
@@ -573,6 +575,9 @@ void ScummEngine::CHARSET_1() {
#endif
restoreCharsetBg();
}
+ _msgCount = 0;
+ } else if (_game.version <= 2) {
+ _talkDelay += _msgCount * _defaultTalkDelay;
}
if (_game.version > 3) {
@@ -600,6 +605,7 @@ void ScummEngine::CHARSET_1() {
// End of text reached, set _haveMsg accordingly
_haveMsg = (_game.version >= 7) ? 2 : 1;
_keepText = false;
+ _msgCount = 0;
break;
}
@@ -648,6 +654,7 @@ void ScummEngine::CHARSET_1() {
}
if (_game.version <= 3) {
_charset->printChar(c, false);
+ _msgCount += 1;
} else {
if (_game.features & GF_16BIT_COLOR) {
// HE games which use sprites for subtitles
Commit: 15b9d61f6e5c49f5fab43fe0ff038a27853fb95c
https://github.com/scummvm/scummvm/commit/15b9d61f6e5c49f5fab43fe0ff038a27853fb95c
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-10T07:12:25+02:00
Commit Message:
SHERLOCK: adjust "early following morning" coords
Changed paths:
engines/sherlock/scalpel/scalpel.cpp
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 89232a7..f3566f6 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -395,7 +395,7 @@ bool ScalpelEngine::showAlleyCutscene() {
if (finished) {
ImageFile titleImages("title3.vgs", true);
// "Early the following morning on Baker Street..."
- _screen->transBlitFrom(titleImages[0], Common::Point(35, 51));
+ _screen->transBlitFrom(titleImages[0], Common::Point(35, 52));
// fast fade-in
_screen->fadeIn(palette, 1);
Commit: 866d7a27d8b0ea28a533f75774dd9ee16c288d38
https://github.com/scummvm/scummvm/commit/866d7a27d8b0ea28a533f75774dd9ee16c288d38
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-10T07:14:13+02:00
Commit Message:
SHERLOCK: 3DO intro: implement fade in/out/merge
Changed paths:
engines/sherlock/scalpel/scalpel.cpp
engines/sherlock/screen.cpp
engines/sherlock/screen.h
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index f3566f6..2f802e2 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -561,21 +561,22 @@ bool ScalpelEngine::showCityCutscene3DO() {
finished = _animation->play3DO("26open1", true, 1, 255, 2);
if (finished) {
- // TODO: Both of these should actually fade into the screen
- _screen->_backBuffer2.blitFrom(*_screen);
+ _screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade
+ _screen->_backBuffer2.blitFrom(*_screen); // save into backbuffer 2, for restoring later
// "London, England"
ImageFile3DO titleImage_London("title2a.cel");
+ _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_London[0]._frame, Common::Point(30, 50));
- _screen->transBlitFromUnscaled3DO(titleImage_London[0]._frame, Common::Point(30, 50));
- finished = _events->delay(2000, true);
+ _screen->fadeIntoScreen3DO(1);
+ finished = _events->delay(1500, true);
if (finished) {
// "November, 1888"
ImageFile3DO titleImage_November("title2b.cel");
+ _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_November[0]._frame, Common::Point(101, 100));
- _screen->transBlitFromUnscaled3DO(titleImage_November[0]._frame, Common::Point(101, 100));
-
+ _screen->fadeIntoScreen3DO(1);
finished = _music->waitUntilMSec(14700, 0, 0, 5000);
}
@@ -589,10 +590,14 @@ bool ScalpelEngine::showCityCutscene3DO() {
finished = _animation->play3DO("26open2", true, 1, 0, 2);
if (finished) {
+ _screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade
+
// "Sherlock Holmes" (title)
ImageFile3DO titleImage_SherlockHolmesTitle("title1ab.cel");
+ _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5));
- _screen->transBlitFromUnscaled3DO(titleImage_SherlockHolmesTitle[0]._frame, Common::Point(34, 5));
+ // Blend in
+ _screen->fadeIntoScreen3DO(2);
finished = _events->delay(500, true);
// Title should fade in, Copyright should be displayed a bit after that
@@ -602,53 +607,52 @@ bool ScalpelEngine::showCityCutscene3DO() {
_screen->transBlitFromUnscaled3DO(titleImage_Copyright[0]._frame, Common::Point(20, 190));
finished = _events->delay(3500, true);
}
- // Title is supposed to get faded away after that
}
if (finished)
finished = _music->waitUntilMSec(33600, 0, 0, 2000);
if (finished) {
- // TODO: fade to black
- _screen->clear();
+ // Fade to black
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(3);
}
if (finished) {
// "In the alley behind the Regency Theatre..."
ImageFile3DO titleImage_InTheAlley("title1d.cel");
+ _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_InTheAlley[0]._frame, Common::Point(72, 51));
- _screen->transBlitFromUnscaled3DO(titleImage_InTheAlley[0]._frame, Common::Point(72, 51));
- // TODO: Supposed to get faded in and out
+ // Fade in
+ _screen->fadeIntoScreen3DO(4);
finished = _music->waitUntilMSec(39900, 0, 0, 2500);
// Fade out
- _screen->clear();
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(4);
}
return finished;
}
bool ScalpelEngine::showAlleyCutscene3DO() {
- bool finished = _music->waitUntilMSec(44000, 0, 0, 1000);
+ bool finished = _music->waitUntilMSec(43500, 0, 0, 1000);
if (finished)
finished = _animation->play3DO("27PRO1", true, 1, 3, 2);
if (finished) {
// Fade out...
- _screen->clear();
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(3);
- finished = _music->waitUntilMSec(66700, 0, 0, 1000);
+ finished = _music->waitUntilMSec(67100, 0, 0, 1000); // 66700
}
if (finished)
finished = _animation->play3DO("27PRO2", true, 1, 0, 2);
- if (finished) {
- // Fade out
- _screen->clear();
-
+ if (finished)
finished = _music->waitUntilMSec(76000, 0, 0, 1000);
- }
if (finished) {
// Show screaming victim
@@ -665,8 +669,9 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
}
if (finished) {
- // TODO: quick fade out
- _screen->clear();
+ // Fade out
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(5);
finished = _music->waitUntilMSec(84400, 0, 0, 2000);
}
@@ -675,17 +680,18 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
finished = _animation->play3DO("27PRO3", true, 1, 0, 2);
if (finished) {
- // Fade to black
- _screen->clear();
+ // Fade out
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(5);
}
if (finished) {
// "Early the following morning on Baker Street..."
ImageFile3DO titleImage_EarlyTheFollowingMorning("title3.cel");
+ _screen->_backBuffer1.transBlitFromUnscaled3DO(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51));
- _screen->transBlitFromUnscaled3DO(titleImage_EarlyTheFollowingMorning[0]._frame, Common::Point(35, 51));
- // TODO: Fade in
-
+ // Fade in
+ _screen->fadeIntoScreen3DO(4);
finished = _music->waitUntilMSec(96700, 0, 0, 3000);
}
@@ -697,7 +703,8 @@ bool ScalpelEngine::showStreetCutscene3DO() {
if (finished) {
// fade out "Early the following morning..."
- _screen->clear();
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(4);
// wait for music a bit
finished = _music->waitUntilMSec(100300, 0, 0, 1000);
@@ -708,8 +715,11 @@ bool ScalpelEngine::showStreetCutscene3DO() {
if (finished)
finished = _animation->play3DO("14NOTE", true, 1, 0, 3);
- // TODO: fade out
- _screen->clear();
+ if (finished) {
+ // Fade out
+ _screen->_backBuffer1.clear();
+ _screen->fadeIntoScreen3DO(4);
+ }
return finished;
}
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index de93d0a..de9bf51 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -231,6 +231,90 @@ void Screen::verticalTransition() {
}
}
+void Screen::fadeIntoScreen3DO(int speed) {
+ Events &events = *_vm->_events;
+ Common::Rect changedRect;
+ uint16 *currentScreenBasePtr = (uint16 *)getPixels();
+ uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
+ uint16 *currentScreenPtr = NULL;
+ uint16 *targetScreenPtr = NULL;
+ uint16 currentScreenPixel = 0;
+ uint16 targetScreenPixel = 0;
+
+ uint16 currentScreenPixelRed = 0;
+ uint16 currentScreenPixelGreen = 0;
+ uint16 currentScreenPixelBlue = 0;
+
+ uint16 targetScreenPixelRed = 0;
+ uint16 targetScreenPixelGreen = 0;
+ uint16 targetScreenPixelBlue = 0;
+
+ uint16 screenWidth = this->w();
+ uint16 screenHeight = this->h();
+ uint16 screenX = 0;
+ uint16 screenY = 0;
+ uint16 pixelsChanged = 0;
+
+ _dirtyRects.clear();
+
+ do {
+ pixelsChanged = 0;
+ currentScreenPtr = currentScreenBasePtr;
+ targetScreenPtr = targetScreenBasePtr;
+
+ for (screenY = 0; screenY < screenHeight; screenY++) {
+ for (screenX = 0; screenX < screenWidth; screenX++) {
+ currentScreenPixel = *currentScreenPtr;
+ targetScreenPixel = *targetScreenPtr;
+
+ if (currentScreenPixel != targetScreenPixel) {
+ // pixel doesn't match, adjust accordingly
+ currentScreenPixelRed = currentScreenPixel & 0xF800;
+ currentScreenPixelGreen = currentScreenPixel & 0x07E0;
+ currentScreenPixelBlue = currentScreenPixel & 0x001F;
+ targetScreenPixelRed = targetScreenPixel & 0xF800;
+ targetScreenPixelGreen = targetScreenPixel & 0x07E0;
+ targetScreenPixelBlue = targetScreenPixel & 0x001F;
+
+ if (currentScreenPixelRed != targetScreenPixelRed) {
+ if (currentScreenPixelRed < targetScreenPixelRed) {
+ currentScreenPixelRed += 0x0800;
+ } else {
+ currentScreenPixelRed -= 0x0800;
+ }
+ }
+ if (currentScreenPixelGreen != targetScreenPixelGreen) {
+ // Adjust +2/-2 because we are running RGB555 at RGB565
+ if (currentScreenPixelGreen < targetScreenPixelGreen) {
+ currentScreenPixelGreen += 0x0040;
+ } else {
+ currentScreenPixelGreen -= 0x0040;
+ }
+ }
+ if (currentScreenPixelBlue != targetScreenPixelBlue) {
+ if (currentScreenPixelBlue < targetScreenPixelBlue) {
+ currentScreenPixelBlue += 0x0001;
+ } else {
+ currentScreenPixelBlue -= 0x0001;
+ }
+ }
+ *currentScreenPtr = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
+ pixelsChanged++;
+ }
+
+ currentScreenPtr++;
+ targetScreenPtr++;
+ }
+ }
+
+ // Too much considered dirty at the moment
+ addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
+
+ events.pollEvents();
+ events.delay(10 * speed);
+ } while ((pixelsChanged) && (!_vm->shouldQuit()));
+}
+
void Screen::restoreBackground(const Common::Rect &r) {
if (r.width() > 0 && r.height() > 0) {
Common::Rect tempRect = r;
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index 9d394da..e4cc665 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -149,6 +149,11 @@ public:
void verticalTransition();
/**
+ * Fade backbuffer 1 into screen (3DO RGB!)
+ */
+ void fadeIntoScreen3DO(int speed);
+
+ /**
* Prints the text passed onto the back buffer at the given position and color.
* The string is then blitted to the screen
*/
Commit: 6aaee559dc7f26240678421043baa865608b7d58
https://github.com/scummvm/scummvm/commit/6aaee559dc7f26240678421043baa865608b7d58
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-10T07:14:15+02:00
Commit Message:
SHERLOCK: 3DO intro: implement fade from white
Changed paths:
engines/sherlock/animation.cpp
engines/sherlock/animation.h
engines/sherlock/scalpel/scalpel.cpp
engines/sherlock/screen.cpp
engines/sherlock/screen.h
engines/sherlock/surface.cpp
engines/sherlock/surface.h
diff --git a/engines/sherlock/animation.cpp b/engines/sherlock/animation.cpp
index 3bd3137..45cb666 100644
--- a/engines/sherlock/animation.cpp
+++ b/engines/sherlock/animation.cpp
@@ -140,17 +140,23 @@ bool Animation::play(const Common::String &filename, bool intro, int minDelay, i
return !skipped && !_vm->shouldQuit();
}
-bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay, int fade,
+bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay, bool fadeFromGrey,
int speed) {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
- Sound &sound = *_vm->_sound;
+ Sound &sound = *_vm->_sound;
int soundNumber = 0;
+ bool fadeActive = false;
+ uint16 fadeLimitColor = 0;
+ uint16 fadeLimitColorRed = 0;
+ uint16 fadeLimitColorGreen = 0;
+ uint16 fadeLimitColorBlue = 0;
+
// Check for any any sound frames for the given animation
const int *soundFrames = checkForSoundFrames(filename, intro);
- // Add on the VDX extension
+ // Add the VDX extension
Common::String indexName = "prologue/" + filename + ".3dx";
// Load the animation
@@ -166,13 +172,11 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay
ImageFile3DO images(graphicsName, true);
events.wait(minDelay);
-// if (fade != 0 && fade != 255)
-// screen.fadeToBlack();
-// if (setPalette) {
-// if (fade != 255)
-// screen.setPalette(images._palette);
-// }
+ if (fadeFromGrey) {
+ fadeActive = true;
+ fadeLimitColor = 0xCE59; // RGB565: 25, 50, 25 -> "grey"
+ }
int frameNumber = 0;
Common::Point pt;
@@ -196,18 +200,36 @@ bool Animation::play3DO(const Common::String &filename, bool intro, int minDelay
// Draw the sprite. Note that we explicitly use the raw frame below, rather than the ImageFrame,
// since we don't want the offsets in the image file to be used, just the explicit position we specify
- screen.transBlitFromUnscaled3DO(images[imageFrame]._frame, pt);
- //events.wait(1000);
+ if (!fadeActive) {
+ screen.transBlitFromUnscaled3DO(images[imageFrame]._frame, pt);
+ } else {
+ // Fade active, blit to backbuffer1
+ screen._backBuffer1.transBlitFromUnscaled3DO(images[imageFrame]._frame, pt);
+ }
} else {
-#if 0
// At this point, either the sprites for the frame has been complete, or there weren't any sprites
// at all to draw for the frame
- //if (fade == 255) {
- // // Gradual fade in
- // if (screen.equalizePalette(images._palette) == 0)
- // fade = 0;
- //}
-#endif
+
+ if (fadeActive) {
+ // process fading
+ screen.blitFrom3DOcolorLimit(fadeLimitColor);
+
+ if (!fadeLimitColor) {
+ // we are at the end, so stop
+ fadeActive = false;
+ } else {
+ // decrease limit color
+ fadeLimitColorRed = fadeLimitColor & 0xF800;
+ fadeLimitColorGreen = fadeLimitColor & 0x07E0;
+ fadeLimitColorBlue = fadeLimitColor & 0x001F;
+ if (fadeLimitColorRed)
+ fadeLimitColor -= 0x0800;
+ if (fadeLimitColorGreen)
+ fadeLimitColor -= 0x0040; // -2 because we are using RGB565, sherlock uses RGB555
+ if (fadeLimitColorBlue)
+ fadeLimitColor -= 0x0001;
+ }
+ }
// Check if we've reached a frame with sound
if (frameNumber++ == *soundFrames) {
diff --git a/engines/sherlock/animation.h b/engines/sherlock/animation.h
index b6e1337..f3c95d4 100644
--- a/engines/sherlock/animation.h
+++ b/engines/sherlock/animation.h
@@ -78,7 +78,7 @@ public:
*/
bool play(const Common::String &filename, bool intro, int minDelay, int fade, bool setPalette, int speed);
- bool play3DO(const Common::String &filename, bool intro, int minDelay, int fade, int speed);
+ bool play3DO(const Common::String &filename, bool intro, int minDelay, bool fadeFromGrey, int speed);
};
} // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 2f802e2..9480bb4 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -540,9 +540,10 @@ bool ScalpelEngine::show3DOSplash() {
if (finished) {
// EA logo movie
Scalpel3DOMoviePlay("EAlogo.stream", Common::Point(20, 0));
- _screen->clear();
}
+ // Always clear screen
+ _screen->clear();
return finished;
}
@@ -552,13 +553,17 @@ bool ScalpelEngine::showCityCutscene3DO() {
// Play intro music
_music->playMusic("prolog");
+ // Fade screen to grey
+ _screen->_backBuffer1.fill(0xCE59); // RGB565: 25, 50, 25 (grey)
+ _screen->fadeIntoScreen3DO(2);
+
// rain.aiff seems to be playing in an endless loop until
// sherlock logo fades away TODO
bool finished = _music->waitUntilMSec(3400, 0, 0, 3400);
if (finished)
- finished = _animation->play3DO("26open1", true, 1, 255, 2);
+ finished = _animation->play3DO("26open1", true, 1, true, 2);
if (finished) {
_screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade
@@ -587,7 +592,7 @@ bool ScalpelEngine::showCityCutscene3DO() {
}
if (finished)
- finished = _animation->play3DO("26open2", true, 1, 0, 2);
+ finished = _animation->play3DO("26open2", true, 1, false, 2);
if (finished) {
_screen->_backBuffer1.blitFrom(*_screen); // save into backbuffer 1, used for fade
@@ -638,7 +643,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
bool finished = _music->waitUntilMSec(43500, 0, 0, 1000);
if (finished)
- finished = _animation->play3DO("27PRO1", true, 1, 3, 2);
+ finished = _animation->play3DO("27PRO1", true, 1, false, 2);
if (finished) {
// Fade out...
@@ -649,7 +654,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
}
if (finished)
- finished = _animation->play3DO("27PRO2", true, 1, 0, 2);
+ finished = _animation->play3DO("27PRO2", true, 1, false, 2);
if (finished)
finished = _music->waitUntilMSec(76000, 0, 0, 1000);
@@ -677,7 +682,7 @@ bool ScalpelEngine::showAlleyCutscene3DO() {
}
if (finished)
- finished = _animation->play3DO("27PRO3", true, 1, 0, 2);
+ finished = _animation->play3DO("27PRO3", true, 1, false, 2);
if (finished) {
// Fade out
@@ -710,10 +715,10 @@ bool ScalpelEngine::showStreetCutscene3DO() {
finished = _music->waitUntilMSec(100300, 0, 0, 1000);
}
- finished = _animation->play3DO("14KICK", true, 1, 3, 2);
+ finished = _animation->play3DO("14KICK", true, 1, false, 2);
if (finished)
- finished = _animation->play3DO("14NOTE", true, 1, 0, 3);
+ finished = _animation->play3DO("14NOTE", true, 1, false, 3);
if (finished) {
// Fade out
@@ -730,10 +735,10 @@ bool ScalpelEngine::showOfficeCutscene3DO() {
finished = _music->waitUntilMSec(151000, 0, 0, 1000);
if (finished)
- _animation->play3DO("COFF1", true, 1, 3, 3);
+ _animation->play3DO("COFF1", true, 1, false, 3);
if (finished)
- finished = _animation->play3DO("COFF2", true, 1, 0, 3);
+ finished = _animation->play3DO("COFF2", true, 1, false, 3);
if (finished)
finished = _music->waitUntilMSec(182400, 0, 0, 1000);
@@ -761,10 +766,10 @@ bool ScalpelEngine::showOfficeCutscene3DO() {
finished = _music->waitUntilMSec(222200, 0, 0, 1000);
if (finished)
- finished = _animation->play3DO("COFF3", true, 1, 0, 3);
+ finished = _animation->play3DO("COFF3", true, 1, false, 3);
if (finished)
- finished = _animation->play3DO("COFF4", true, 1, 0, 3);
+ finished = _animation->play3DO("COFF4", true, 1, false, 3);
return finished;
}
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index de9bf51..99e09b4 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -233,7 +233,6 @@ void Screen::verticalTransition() {
void Screen::fadeIntoScreen3DO(int speed) {
Events &events = *_vm->_events;
- Common::Rect changedRect;
uint16 *currentScreenBasePtr = (uint16 *)getPixels();
uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
uint16 *currentScreenPtr = NULL;
@@ -315,6 +314,49 @@ void Screen::fadeIntoScreen3DO(int speed) {
} while ((pixelsChanged) && (!_vm->shouldQuit()));
}
+void Screen::blitFrom3DOcolorLimit(uint16 limitColor) {
+ uint16 *currentScreenPtr = (uint16 *)getPixels();
+ uint16 *targetScreenPtr = (uint16 *)_backBuffer->getPixels();
+ uint16 currentScreenPixel = 0;
+
+ uint16 screenWidth = this->w();
+ uint16 screenHeight = this->h();
+ uint16 screenX = 0;
+ uint16 screenY = 0;
+
+ uint16 currentScreenPixelRed = 0;
+ uint16 currentScreenPixelGreen = 0;
+ uint16 currentScreenPixelBlue = 0;
+
+ uint16 limitPixelRed = limitColor & 0xF800;
+ uint16 limitPixelGreen = limitColor & 0x07E0;
+ uint16 limitPixelBlue = limitColor & 0x001F;
+
+ for (screenY = 0; screenY < screenHeight; screenY++) {
+ for (screenX = 0; screenX < screenWidth; screenX++) {
+ currentScreenPixel = *targetScreenPtr;
+
+ currentScreenPixelRed = currentScreenPixel & 0xF800;
+ currentScreenPixelGreen = currentScreenPixel & 0x07E0;
+ currentScreenPixelBlue = currentScreenPixel & 0x001F;
+
+ if (currentScreenPixelRed < limitPixelRed)
+ currentScreenPixelRed = limitPixelRed;
+ if (currentScreenPixelGreen < limitPixelGreen)
+ currentScreenPixelGreen = limitPixelGreen;
+ if (currentScreenPixelBlue < limitPixelBlue)
+ currentScreenPixelBlue = limitPixelBlue;
+
+ *currentScreenPtr = currentScreenPixelRed | currentScreenPixelGreen | currentScreenPixelBlue;
+ currentScreenPtr++;
+ targetScreenPtr++;
+ }
+ }
+
+ // Too much considered dirty at the moment
+ addDirtyRect(Common::Rect(0, 0, screenWidth, screenHeight));
+}
+
void Screen::restoreBackground(const Common::Rect &r) {
if (r.width() > 0 && r.height() > 0) {
Common::Rect tempRect = r;
diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h
index e4cc665..661cc48 100644
--- a/engines/sherlock/screen.h
+++ b/engines/sherlock/screen.h
@@ -153,6 +153,8 @@ public:
*/
void fadeIntoScreen3DO(int speed);
+ void blitFrom3DOcolorLimit(uint16 color);
+
/**
* Prints the text passed onto the back buffer at the given position and color.
* The string is then blitted to the screen
diff --git a/engines/sherlock/surface.cpp b/engines/sherlock/surface.cpp
index 3bbaf46..0f6fa94 100644
--- a/engines/sherlock/surface.cpp
+++ b/engines/sherlock/surface.cpp
@@ -226,6 +226,10 @@ void Surface::fillRect(const Common::Rect &r, byte color) {
addDirtyRect(r);
}
+void Surface::fill(uint16 color) {
+ _surface.fillRect(Common::Rect(_surface.w, _surface.h), color);
+}
+
bool Surface::clip(Common::Rect &srcBounds, Common::Rect &destBounds) {
if (destBounds.left >= _surface.w || destBounds.top >= _surface.h ||
destBounds.right <= 0 || destBounds.bottom <= 0)
diff --git a/engines/sherlock/surface.h b/engines/sherlock/surface.h
index 68108a6..dc2ba7b 100644
--- a/engines/sherlock/surface.h
+++ b/engines/sherlock/surface.h
@@ -139,6 +139,8 @@ public:
*/
void fillRect(const Common::Rect &r, byte color);
+ void fill(uint16 color);
+
void maskArea(const ImageFrame &src, const Common::Point &pt, int scrollX);
/**
Commit: ce6ad7e6d8a9a499b5e1192947ef36efaae52ed3
https://github.com/scummvm/scummvm/commit/ce6ad7e6d8a9a499b5e1192947ef36efaae52ed3
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-06-10T07:14:15+02:00
Commit Message:
SHERLOCK: Fix tiny memory leak
Changed paths:
engines/sherlock/scalpel/scalpel.cpp
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 9480bb4..c5eaa9c 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -187,11 +187,11 @@ ScalpelEngine::~ScalpelEngine() {
void ScalpelEngine::initialize() {
// 3DO actually uses RGB555, but some platforms of ours only support RGB565, so we use that
- const Graphics::PixelFormat *pixelFormatRGB565 = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
if (getPlatform() == Common::kPlatform3DO) {
+ const Graphics::PixelFormat pixelFormatRGB565 = Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
// 320x200 16-bit RGB565 for 3DO support
- initGraphics(320, 200, false, pixelFormatRGB565);
+ initGraphics(320, 200, false, &pixelFormatRGB565);
} else {
// 320x200 palettized
initGraphics(320, 200, false);
Commit: 256158cbe225c2c8f2d663c7620d9d9ed9587b38
https://github.com/scummvm/scummvm/commit/256158cbe225c2c8f2d663c7620d9d9ed9587b38
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-10T07:14:15+02:00
Commit Message:
SHERLOCK: free midi music buffer
Changed paths:
engines/sherlock/music.cpp
engines/sherlock/music.h
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index 346d087..23ce07a 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -198,6 +198,9 @@ Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_musicPlaying = false;
_musicOn = false;
+ _midiMusicData = NULL;
+ _midiMusicDataSize = 0;
+
if (_vm->getPlatform() == Common::kPlatform3DO) {
// 3DO - uses digital samples for music
_musicOn = true;
@@ -274,6 +277,7 @@ Music::~Music() {
_midiDriver->close();
delete _midiDriver;
}
+ freeSong();
}
bool Music::loadSong(int songNumber) {
@@ -330,11 +334,10 @@ bool Music::playMusic(const Common::String &name) {
Common::String midiMusicName = name + ".MUS";
Common::SeekableReadStream *stream = _vm->_res->load(midiMusicName, "MUSIC.LIB");
- byte *data = new byte[stream->size()];
- int32 dataSize = stream->size();
- assert(data);
+ _midiMusicData = new byte[stream->size()];
+ _midiMusicDataSize = stream->size();
- stream->read(data, dataSize);
+ stream->read(_midiMusicData, _midiMusicDataSize);
delete stream;
// for dumping the music tracks
@@ -346,12 +349,14 @@ bool Music::playMusic(const Common::String &name) {
outFile.close();
#endif
- if (dataSize < 14) {
+ if (_midiMusicDataSize < 14) {
warning("Music: not enough data in music file");
return false;
}
- byte *dataPos = data;
+ byte *dataPos = _midiMusicData;
+ int32 dataSize = _midiMusicDataSize;
+
if (memcmp(" ", dataPos, 12)) {
warning("Music: expected header not found in music file");
return false;
@@ -435,6 +440,12 @@ void Music::startSong() {
void Music::freeSong() {
// TODO
warning("TODO: Sound::freeSong");
+ if (_midiMusicData) {
+ // free midi data buffer
+ delete[] _midiMusicData;
+ _midiMusicData = NULL;
+ _midiMusicDataSize = 0;
+ }
}
void Music::waitTimerRoland(uint time) {
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index f8cad3f..1e2b91a 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -71,6 +71,9 @@ public:
private:
MusicType _musicType;
+ byte *_midiMusicData;
+ int32 _midiMusicDataSize;
+
public:
/**
* Saves sound-related settings
Commit: 1c44fa5bbc5f91f0c48696c66b65d117457b2ec8
https://github.com/scummvm/scummvm/commit/1c44fa5bbc5f91f0c48696c66b65d117457b2ec8
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-10T07:14:16+02:00
Commit Message:
Merge branch 'master' of github.com:scummvm/scummvm
Changed paths:
engines/sherlock/scalpel/scalpel.cpp
More information about the Scummvm-git-logs
mailing list