[Scummvm-cvs-logs] scummvm master -> 0f432b90030b06682b328d59c639f476cc133a85
bgK
bastien.bouclet at gmail.com
Sun Dec 16 10:32:05 CET 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
edb8b6e236 MOHAWK: Add the remaining Myst transition effects
0f432b9003 TEST: Add some tests for Common::BitStreamImpl
Commit: edb8b6e236cf44154193acccee3d7840cae1f121
https://github.com/scummvm/scummvm/commit/edb8b6e236cf44154193acccee3d7840cae1f121
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2012-12-16T01:28:23-08:00
Commit Message:
MOHAWK: Add the remaining Myst transition effects
Changed paths:
engines/mohawk/myst.h
engines/mohawk/myst_graphics.cpp
engines/mohawk/myst_graphics.h
engines/mohawk/myst_stacks/mechanical.cpp
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 43559e2..a268c19 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -79,10 +79,13 @@ enum {
enum TransitionType {
kTransitionLeftToRight = 0,
kTransitionRightToLeft = 1,
- kTransitionUnk2 = 2,
+ kTransitionSlideToLeft = 2,
+ kTransitionSlideToRight = 3,
kTransitionDissolve = 4,
kTransitionTopToBottom = 5,
kTransitionBottomToTop = 6,
+ kTransitionSlideToTop = 7,
+ kTransitionSlideToBottom= 8,
kTransitionPartToRight = 9,
kTransitionPartToLeft = 10,
kTransitionCopy = 11,
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 9eeb191..6a292c6 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -217,7 +217,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
switch (type) {
case kTransitionLeftToRight: {
- debugC(kDebugScript, "Left to Right");
+ debugC(kDebugView, "Left to Right");
uint16 step = (rect.right - rect.left) / steps;
Common::Rect area = rect;
@@ -240,7 +240,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionRightToLeft: {
- debugC(kDebugScript, "Right to Left");
+ debugC(kDebugView, "Right to Left");
uint16 step = (rect.right - rect.left) / steps;
Common::Rect area = rect;
@@ -262,8 +262,16 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
}
break;
+ case kTransitionSlideToLeft:
+ debugC(kDebugView, "Slide to left");
+ transitionSlideToLeft(rect, steps, delay);
+ break;
+ case kTransitionSlideToRight:
+ debugC(kDebugView, "Slide to right");
+ transitionSlideToRight(rect, steps, delay);
+ break;
case kTransitionDissolve: {
- debugC(kDebugScript, "Dissolve");
+ debugC(kDebugView, "Dissolve");
for (int16 step = 0; step < 8; step++) {
simulatePreviousDrawDelay(rect);
@@ -272,7 +280,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionTopToBottom: {
- debugC(kDebugScript, "Top to Bottom");
+ debugC(kDebugView, "Top to Bottom");
uint16 step = (rect.bottom - rect.top) / steps;
Common::Rect area = rect;
@@ -295,7 +303,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionBottomToTop: {
- debugC(kDebugScript, "Bottom to Top");
+ debugC(kDebugView, "Bottom to Top");
uint16 step = (rect.bottom - rect.top) / steps;
Common::Rect area = rect;
@@ -317,32 +325,37 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
}
break;
+ case kTransitionSlideToTop:
+ debugC(kDebugView, "Slide to top");
+ transitionSlideToTop(rect, steps, delay);
+ break;
+ case kTransitionSlideToBottom:
+ debugC(kDebugView, "Slide to bottom");
+ transitionSlideToBottom(rect, steps, delay);
+ break;
case kTransitionPartToRight: {
- debugC(kDebugScript, "Partial left to right");
+ debugC(kDebugView, "Partial left to right");
transitionPartialToRight(rect, 75, 3);
}
break;
case kTransitionPartToLeft: {
- debugC(kDebugScript, "Partial right to left");
+ debugC(kDebugView, "Partial right to left");
transitionPartialToLeft(rect, 75, 3);
}
break;
- default:
- //TODO: Replace minimal implementation
- warning("Unknown transition %d", type);
- // Fallthrough
case kTransitionCopy:
copyBackBufferToScreen(rect);
_vm->_system->updateScreen();
break;
+ default:
+ error("Unknown transition %d", type);
}
_enableDrawingTimeSimulation = oldEnableDrawingTimeSimulation;
}
-
void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
static const bool pattern[][4][4] = {
{
@@ -422,8 +435,109 @@ void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
_vm->_system->updateScreen();
}
-void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps)
-{
+void MystGraphics::transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.right - rect.left) / steps;
+ Common::Rect srcRect = Common::Rect(rect.right, rect.top, rect.right, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.top, rect.left, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.right = dstRect.left + step * stepWidth;
+ srcRect.left = srcRect.right - step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+ if (dstRect.right != rect.right) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.right - rect.left) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.top, rect.left, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.right, rect.top, rect.right, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.left = dstRect.right - step * stepWidth;
+ srcRect.right = srcRect.left + step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+ if (dstRect.left != rect.left) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.bottom - rect.top) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.bottom, rect.right, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.top, rect.right, rect.top);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.bottom = dstRect.top + step * stepWidth;
+ srcRect.top = srcRect.bottom - step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+
+ if (dstRect.bottom < rect.bottom) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToBottom(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.bottom - rect.top) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.top, rect.right, rect.top);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.bottom, rect.right, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.top = dstRect.bottom - step * stepWidth;
+ srcRect.bottom = srcRect.top + step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+
+ if (dstRect.top > rect.top) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps) {
rect.clip(_viewport);
uint32 stepWidth = width / steps;
@@ -444,8 +558,7 @@ void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uin
_vm->_system->updateScreen();
}
-void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps)
-{
+void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps) {
rect.clip(_viewport);
uint32 stepWidth = width / steps;
diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h
index 04eb1b9..4bbc8d5 100644
--- a/engines/mohawk/myst_graphics.h
+++ b/engines/mohawk/myst_graphics.h
@@ -61,6 +61,10 @@ protected:
void simulatePreviousDrawDelay(const Common::Rect &dest);
void copyBackBufferToScreenWithSaturation(int16 saturation);
void transitionDissolve(Common::Rect rect, uint step);
+ void transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToBottom(Common::Rect rect, uint16 steps, uint16 delay);
void transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps);
void transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps);
private:
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index d6069a1..9e68889 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -616,7 +616,7 @@ void Mechanical::elevatorGoMiddle_run() {
_vm->_sound->playSoundBlocking(11120);
_vm->_gfx->copyImageToBackBuffer(6118, Common::Rect(544, 333));
_vm->_sound->replaceSoundMyst(12120);
- _vm->_gfx->runTransition(kTransitionUnk2, Common::Rect(177, 0, 370, 333), 25, 0);
+ _vm->_gfx->runTransition(kTransitionSlideToLeft, Common::Rect(177, 0, 370, 333), 25, 0);
_vm->_sound->playSoundBlocking(13120);
_vm->_sound->replaceSoundMyst(8120);
_vm->_gfx->copyImageToBackBuffer(6327, Common::Rect(544, 333));
Commit: 0f432b90030b06682b328d59c639f476cc133a85
https://github.com/scummvm/scummvm/commit/0f432b90030b06682b328d59c639f476cc133a85
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2012-12-16T01:29:58-08:00
Commit Message:
TEST: Add some tests for Common::BitStreamImpl
Changed paths:
A test/common/bitstream.h
diff --git a/test/common/bitstream.h b/test/common/bitstream.h
new file mode 100644
index 0000000..c14fe56
--- /dev/null
+++ b/test/common/bitstream.h
@@ -0,0 +1,151 @@
+#include <cxxtest/TestSuite.h>
+
+#include "common/bitstream.h"
+
+class BitStreamTestSuite : public CxxTest::TestSuite
+{
+ public:
+ void test_get_bit() {
+ byte contents[] = { 'a' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.getBit(), 0u);
+ TS_ASSERT_EQUALS(bs.getBit(), 1u);
+ TS_ASSERT_EQUALS(bs.getBit(), 1u);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_get_bits() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.getBits(3), 3u);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ TS_ASSERT_EQUALS(bs.getBits(8), 11u);
+ TS_ASSERT_EQUALS(bs.pos(), 11u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_skip() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ bs.skip(5);
+ TS_ASSERT_EQUALS(bs.pos(), 5u);
+ bs.skip(4);
+ TS_ASSERT_EQUALS(bs.pos(), 9u);
+ TS_ASSERT_EQUALS(bs.getBits(3), 6u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_rewind() {
+ byte contents[] = { 'a' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ bs.skip(5);
+ TS_ASSERT_EQUALS(bs.pos(), 5u);
+ bs.rewind();
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.getBits(3), 3u);
+ TS_ASSERT(!bs.eos());
+
+ TS_ASSERT_EQUALS(bs.size(), 8u);
+ }
+
+ void test_peek_bit() {
+ byte contents[] = { 'a' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.peekBit(), 0u);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.getBit(), 0u);
+ TS_ASSERT_EQUALS(bs.pos(), 1u);
+ TS_ASSERT_EQUALS(bs.peekBit(), 1u);
+ TS_ASSERT_EQUALS(bs.pos(), 1u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_peek_bits() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.peekBits(3), 3u);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ bs.skip(3);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ TS_ASSERT_EQUALS(bs.peekBits(8), 11u);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ bs.skip(8);
+ TS_ASSERT_EQUALS(bs.pos(), 11u);
+ TS_ASSERT_EQUALS(bs.peekBits(5), 2u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_eos() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8MSB bs(ms);
+ bs.skip(11);
+ TS_ASSERT_EQUALS(bs.pos(), 11u);
+ TS_ASSERT_EQUALS(bs.getBits(5), 2u);
+ TS_ASSERT(bs.eos());
+
+ bs.rewind();
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_get_bits_lsb() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8LSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.getBits(3), 1u);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ TS_ASSERT_EQUALS(bs.getBits(8), 76u);
+ TS_ASSERT_EQUALS(bs.pos(), 11u);
+ TS_ASSERT(!bs.eos());
+ }
+
+ void test_peek_bits_lsb() {
+ byte contents[] = { 'a', 'b' };
+
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::BitStream8LSB bs(ms);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ TS_ASSERT_EQUALS(bs.peekBits(3), 1u);
+ TS_ASSERT_EQUALS(bs.pos(), 0u);
+ bs.skip(3);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ TS_ASSERT_EQUALS(bs.peekBits(8), 76u);
+ TS_ASSERT_EQUALS(bs.pos(), 3u);
+ bs.skip(8);
+ TS_ASSERT_EQUALS(bs.pos(), 11u);
+ TS_ASSERT_EQUALS(bs.peekBits(5), 12u);
+ TS_ASSERT(!bs.eos());
+ }
+};
More information about the Scummvm-git-logs
mailing list