[Scummvm-git-logs] scummvm master -> c71690a146a7ab4f0be1922b4e6541403b560ad3

mgerhardy martin.gerhardy at gmail.com
Thu Dec 24 12:13:42 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
728617c397 TWINE: fixed amiga compilation
afa1eb4fa8 TWINE: brick parser
c71690a146 TWINE: sprite parser


Commit: 728617c39792c11b555dd9bd2e44d6b44fe6f6d8
    https://github.com/scummvm/scummvm/commit/728617c39792c11b555dd9bd2e44d6b44fe6f6d8
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-24T13:13:12+01:00

Commit Message:
TWINE: fixed amiga compilation

Changed paths:
    engines/twine/menu/interface.cpp


diff --git a/engines/twine/menu/interface.cpp b/engines/twine/menu/interface.cpp
index fc48965631..7b1227cd27 100644
--- a/engines/twine/menu/interface.cpp
+++ b/engines/twine/menu/interface.cpp
@@ -141,10 +141,10 @@ void Interface::drawLine(int32 startWidth, int32 startHeight, int32 endWidth, in
 
 // TODO: this should get replaced by the surface blitting functions
 void Interface::blitBox(const Common::Rect &rect, const Graphics::ManagedSurface &source, Graphics::ManagedSurface &dest) {
-	const int32 left = MAX(SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
-	const int32 top = MAX(SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
-	const int32 right = MIN(SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
-	const int32 bottom = MIN(SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
+	const int32 left = MAX((int32)SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
+	const int32 top = MAX((int32)SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
+	const int32 right = MIN((int32)SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
+	const int32 bottom = MIN((int32)SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
 
 	if (left > SCREEN_TEXTLIMIT_RIGHT) {
 		return;
@@ -173,10 +173,10 @@ void Interface::blitBox(const Common::Rect &rect, const Graphics::ManagedSurface
 }
 
 void Interface::drawTransparentBox(const Common::Rect &rect, int32 colorAdj) {
-	const int32 left = MAX(SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
-	const int32 top = MAX(SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
-	const int32 right = MIN(SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
-	const int32 bottom = MIN(SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
+	const int32 left = MAX((int32)SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
+	const int32 top = MAX((int32)SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
+	const int32 right = MIN((int32)SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
+	const int32 bottom = MIN((int32)SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
 
 	if (left > SCREEN_TEXTLIMIT_RIGHT) {
 		return;
@@ -208,10 +208,10 @@ void Interface::drawTransparentBox(const Common::Rect &rect, int32 colorAdj) {
 }
 
 void Interface::drawSplittedBox(const Common::Rect &rect, uint8 colorIndex) {
-	const int32 left = MAX(SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
-	const int32 top = MAX(SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
-	const int32 right = MIN(SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
-	const int32 bottom = MIN(SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
+	const int32 left = MAX((int32)SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
+	const int32 top = MAX((int32)SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
+	const int32 right = MIN((int32)SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
+	const int32 bottom = MIN((int32)SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
 
 	if (left > SCREEN_TEXTLIMIT_RIGHT) {
 		return;
@@ -234,10 +234,10 @@ void Interface::drawSplittedBox(const Common::Rect &rect, uint8 colorIndex) {
 }
 
 void Interface::setClip(const Common::Rect &rect) {
-	textWindow.left = MAX(SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
-	textWindow.top = MAX(SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
-	textWindow.right = MIN(SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
-	textWindow.bottom = MIN(SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
+	textWindow.left = MAX((int32)SCREEN_TEXTLIMIT_LEFT, (int32)rect.left);
+	textWindow.top = MAX((int32)SCREEN_TEXTLIMIT_TOP, (int32)rect.top);
+	textWindow.right = MIN((int32)SCREEN_TEXTLIMIT_RIGHT, (int32)rect.right);
+	textWindow.bottom = MIN((int32)SCREEN_TEXTLIMIT_BOTTOM, (int32)rect.bottom);
 }
 
 void Interface::saveClip() {


Commit: afa1eb4fa84d9022f76f4feb7b9eefd302821655
    https://github.com/scummvm/scummvm/commit/afa1eb4fa84d9022f76f4feb7b9eefd302821655
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-24T13:13:12+01:00

Commit Message:
TWINE: brick parser

Changed paths:
  A engines/twine/parser/brick.cpp
  A engines/twine/parser/brick.h
    engines/twine/module.mk


diff --git a/engines/twine/module.mk b/engines/twine/module.mk
index e605ec791d..31d40fba86 100644
--- a/engines/twine/module.mk
+++ b/engines/twine/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS := \
 	parser/anim.o \
 	parser/body.o \
 	parser/entity.o \
+	parser/brick.o \
 	parser/parser.o \
 	parser/sprite.o \
 	\
diff --git a/engines/twine/parser/brick.cpp b/engines/twine/parser/brick.cpp
new file mode 100644
index 0000000000..e81244d58a
--- /dev/null
+++ b/engines/twine/parser/brick.cpp
@@ -0,0 +1,60 @@
+/* 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 "twine/parser/brick.h"
+#include "common/debug.h"
+#include "common/memstream.h"
+
+namespace TwinE {
+
+bool BrickData::loadFromStream(Common::SeekableReadStream &stream) {
+	int width = stream.readByte();
+	int height = stream.readByte();
+	_offsetX = stream.readByte();
+	_offsetY = stream.readByte();
+	const int maxY = _offsetY + height;
+	const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
+	_surface.create(width, height, format);
+	for (int y = _offsetY; y < maxY; ++y) {
+		const uint8 numRuns = stream.readByte();
+		int x = _offsetX;
+		for (uint8 run = 0; run < numRuns; ++run) {
+			const uint8 runSpec = stream.readByte();
+			const uint8 runLength = bits(runSpec, 0, 6) + 1;
+			const uint8 type = bits(runSpec, 6, 2);
+			if (type == 2) {
+				uint8 *start = (uint8 *)_surface.getBasePtr(x, y);
+				uint8 *end = (uint8 *)_surface.getBasePtr(x + runLength, y);
+				Common::fill(start, end, stream.readByte());
+			} else if (type == 1 || type == 3) {
+				uint8 *start = (uint8 *)_surface.getBasePtr(x, y);
+				for (uint8 i = 0; i < runLength; ++i) {
+					*start++ = stream.readByte();
+				}
+			}
+			x += runLength;
+		}
+	}
+	return !stream.err();
+}
+
+} // namespace TwinE
diff --git a/engines/twine/parser/brick.h b/engines/twine/parser/brick.h
new file mode 100644
index 0000000000..1c3160b5a8
--- /dev/null
+++ b/engines/twine/parser/brick.h
@@ -0,0 +1,58 @@
+/* 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.
+ *
+ */
+
+#ifndef TWINE_BRICK_H
+#define TWINE_BRICK_H
+
+#include "common/memstream.h"
+#include "common/stream.h"
+#include "graphics/managed_surface.h"
+#include "twine/parser/parser.h"
+#include "twine/shared.h"
+
+namespace TwinE {
+
+class BrickData : public Parser {
+private:
+	Graphics::ManagedSurface _surface;
+	int _offsetX = 0;
+	int _offsetY = 0;
+
+public:
+	bool loadFromStream(Common::SeekableReadStream &stream) override;
+
+	inline const Graphics::ManagedSurface &surface() const {
+		return _surface;
+	}
+
+	inline int offsetX() const {
+		return _offsetX;
+	}
+
+	inline int offsetY() const {
+		return _offsetY;
+	}
+};
+
+} // End of namespace TwinE
+
+#endif


Commit: c71690a146a7ab4f0be1922b4e6541403b560ad3
    https://github.com/scummvm/scummvm/commit/c71690a146a7ab4f0be1922b4e6541403b560ad3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-24T13:13:12+01:00

Commit Message:
TWINE: sprite parser

Changed paths:
    engines/twine/parser/sprite.cpp
    engines/twine/parser/sprite.h


diff --git a/engines/twine/parser/sprite.cpp b/engines/twine/parser/sprite.cpp
index 5ef7046ae6..d9dc67da7e 100644
--- a/engines/twine/parser/sprite.cpp
+++ b/engines/twine/parser/sprite.cpp
@@ -46,4 +46,36 @@ bool SpriteBoundingBoxData::loadFromStream(Common::SeekableReadStream &stream) {
 	return !stream.err();
 }
 
-} // End of namespace TwinE
+bool SpriteData::loadFromStream(Common::SeekableReadStream &stream) {
+	stream.skip(8);
+	int width = stream.readByte();
+	int height = stream.readByte();
+	_offsetX = stream.readByte();
+	_offsetY = stream.readByte();
+	const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
+	_surface.create(width, height, format);
+	const int maxY = _offsetY + height;
+	for (int y = _offsetY; y < maxY; ++y) {
+		const uint8 numRuns = stream.readByte();
+		int x = _offsetX;
+		for (uint8 run = 0; run < numRuns; ++run) {
+			const uint8 runSpec = stream.readByte();
+			const uint8 runLength = bits(runSpec, 0, 6) + 1;
+			const uint8 type = bits(runSpec, 6, 2);
+			if (type == 2) {
+				uint8 *start = (uint8 *)_surface.getBasePtr(x, y);
+				uint8 *end = (uint8 *)_surface.getBasePtr(x + runLength, y);
+				Common::fill(start, end, stream.readByte());
+			} else if (type == 1 || type == 3) {
+				uint8 *start = (uint8 *)_surface.getBasePtr(x, y);
+				for (uint8 i = 0; i < runLength; ++i) {
+					*start++ = stream.readByte();
+				}
+			}
+			x += runLength;
+		}
+	}
+	return !stream.err();
+}
+
+} // namespace TwinE
diff --git a/engines/twine/parser/sprite.h b/engines/twine/parser/sprite.h
index 080abf3aed..fd6f0f6d87 100644
--- a/engines/twine/parser/sprite.h
+++ b/engines/twine/parser/sprite.h
@@ -26,6 +26,7 @@
 #include "common/array.h"
 #include "common/memstream.h"
 #include "common/stream.h"
+#include "graphics/managed_surface.h"
 #include "twine/parser/parser.h"
 #include "twine/shared.h"
 
@@ -64,6 +65,28 @@ inline const SpriteDim *SpriteBoundingBoxData::dim(int index) const {
 	return &_dimensions[index];
 }
 
+class SpriteData : public Parser {
+private:
+	Graphics::ManagedSurface _surface;
+	int _offsetX = 0;
+	int _offsetY = 0;
+
+public:
+	bool loadFromStream(Common::SeekableReadStream &stream) override;
+
+	inline const Graphics::ManagedSurface &surface() const {
+		return _surface;
+	}
+
+	inline int offsetX() const {
+		return _offsetX;
+	}
+
+	inline int offsetY() const {
+		return _offsetY;
+	}
+};
+
 } // End of namespace TwinE
 
 #endif




More information about the Scummvm-git-logs mailing list