[Scummvm-cvs-logs] scummvm master -> f47ab0000f503b2d4fa138550cb6bd636aa7a3db

sev- sev at scummvm.org
Mon Aug 22 10:27:02 CEST 2016


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:
fdb451baca DIRECTOR: Improvements to the BITD rendering
f47ab0000f DIRECTOR: Lingo: Improved debug output


Commit: fdb451bacaae8fdd5c3cf5a29502ac13163b511c
    https://github.com/scummvm/scummvm/commit/fdb451bacaae8fdd5c3cf5a29502ac13163b511c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-22T09:51:56+02:00

Commit Message:
DIRECTOR: Improvements to the BITD rendering

Changed paths:
    engines/director/images.cpp
    engines/director/images.h
    engines/director/score.cpp
    engines/director/score.h



diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index 0b440e1..67ffb5d 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -108,11 +108,20 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
 	return true;
 }
 
-BITDDecoder::BITDDecoder() {
-	_surface = 0;
-	_palette = 0;
-	_paletteColorCount = 0;
-	_codec = 0;
+/****************************
+ * BITD
+ ****************************/
+
+BITDDecoder::BITDDecoder(int w, int h) {
+	_surface = new Graphics::Surface();
+	_surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
+
+	_palette = new byte[255 * 3];
+
+	_palette[0] = _palette[1] = _palette[2] = 0;
+	_palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff;
+
+	_paletteColorCount = 2;
 }
 
 BITDDecoder::~BITDDecoder() {
@@ -125,30 +134,16 @@ void BITDDecoder::destroy() {
 	delete[] _palette;
 	_palette = 0;
 	_paletteColorCount = 0;
-
-	delete _codec;
-	_codec = 0;
 }
 
 void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
-	_palette = new byte[255 * 3];
-
-	_palette[0] = _palette[1] = _palette[2] = 0;
-	_palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff;
-
-	_paletteColorCount = 2;
+	// no op
 }
 
 bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
-	uint32 width = 512; // Should come from the Cast
-	uint32 height = 342;
-
-	_surface = new Graphics::Surface();
-	_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-
 	int x = 0, y = 0;
 
-	while (y < height) {
+	while (y < _surface->h) {
 		int n = stream.readSByte();
 		int count;
 		int b = 0;
@@ -168,7 +163,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 			count = 0;
 		}
 
-		for (int i = 0; i < count && y < height; i++) {
+		for (int i = 0; i < count && y < _surface->h; i++) {
 			byte color = 0;
 			if (state == 1) {
 				color = stream.readByte();
@@ -178,7 +173,7 @@ bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
 			for (int c = 0; c < 8; c++) {
 				*((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c % 8))) ? 0 : 0xff;
 				x++;
-				if (x == width) {
+				if (x == _surface->w) {
 					y++;
 					x = 0;
 					break;
diff --git a/engines/director/images.h b/engines/director/images.h
index 821b85a..54e8245 100644
--- a/engines/director/images.h
+++ b/engines/director/images.h
@@ -64,7 +64,7 @@ private:
 
 class BITDDecoder : public Image::ImageDecoder {
 public:
-	BITDDecoder();
+	BITDDecoder(int w, int h);
 	virtual ~BITDDecoder();
 
 	// ImageDecoder API
@@ -76,7 +76,6 @@ public:
 	uint16 getPaletteColorCount() const { return _paletteColorCount; }
 
 private:
-	Image::Codec *_codec;
 	Graphics::Surface *_surface;
 	byte *_palette;
 	uint8 _paletteColorCount;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6628208..ccadac2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1240,7 +1240,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
 				continue;
 			}
 
-			Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
+			Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId, _sprites[i]->_width, _sprites[i]->_height);
 
 			if (!img) {
 				warning("Image with id %d not found", _sprites[i]->_castId);
@@ -1321,7 +1321,7 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
 	}
 }
 
-Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
+Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId, int w, int h) {
 	uint16 imgId = spriteId + 1024;
 	Image::ImageDecoder *img = NULL;
 
@@ -1339,7 +1339,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
 
 	if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
 		if (_vm->getVersion() < 4) {
-			img = new BITDDecoder();
+			img = new BITDDecoder(w, h);
 		} else {
 			img = new Image::BitmapDecoder();
 		}
diff --git a/engines/director/score.h b/engines/director/score.h
index a7ca59b..929dae6 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -347,7 +347,7 @@ private:
 	void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
 	void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
 	void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
-	Image::ImageDecoder *getImageFrom(uint16 spriteID);
+	Image::ImageDecoder *getImageFrom(uint16 spriteID, int w, int h);
 	void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
 	void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
 	void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);


Commit: f47ab0000f503b2d4fa138550cb6bd636aa7a3db
    https://github.com/scummvm/scummvm/commit/f47ab0000f503b2d4fa138550cb6bd636aa7a3db
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-22T10:02:14+02:00

Commit Message:
DIRECTOR: Lingo: Improved debug output

Changed paths:
    engines/director/lingo/lingo-codegen.cpp
    engines/director/lingo/lingo.h



diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 32ddea4..9f3b1e2 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -55,20 +55,28 @@ void Lingo::execute(int pc) {
 	for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
 		Common::String instr = decodeInstruction(_pc);
 
-		debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str());
-
-		Common::String stack("Stack: ");
+		if (debugChannelSet(5, kDebugLingoExec))
+			printStack("Stack before: ");
 
-		for (uint i = 0; i < _stack.size(); i++) {
-			Datum d = _stack[i];
-			d.toString();
-			stack += Common::String::format("<%s> ", d.u.s->c_str());
-		}
-		debugC(5, kDebugLingoExec, "%s", stack.c_str());
+		debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str());
 
 		_pc++;
 		(*((*_currentScript)[_pc - 1]))();
+
+		if (debugChannelSet(5, kDebugLingoExec))
+			printStack("Stack after: ");
+	}
+}
+
+void Lingo::printStack(const char *s) {
+	Common::String stack(s);
+
+	for (uint i = 0; i < _stack.size(); i++) {
+		Datum d = _stack[i];
+		d.toString();
+		stack += Common::String::format("<%s> ", d.u.s->c_str());
 	}
+	debugC(5, kDebugLingoExec, "%s", stack.c_str());
 }
 
 Common::String Lingo::decodeInstruction(int pc, int *newPc) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5f4eb78..b197abd 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -175,6 +175,7 @@ public:
 
 	void addCode(const char *code, ScriptType type, uint16 id);
 	void executeScript(ScriptType type, uint16 id);
+	void printStack(const char *s);
 	Common::String decodeInstruction(int pc, int *newPC = NULL);
 
 	void processEvent(LEvent event, int entityId);






More information about the Scummvm-git-logs mailing list