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

sev- noreply at scummvm.org
Sun Sep 8 14:19:25 UTC 2024


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

Summary:
30033b0674 QDENGINE: Implement qdAnimation::hit() and qdAnimation::hit(scale)
682e6418a5 QDENGINE: Finish implementation of qdAnimation::redraw(scale)
f954bcf3b2 QDENGINE: Implement code differences for qdAnimation::draw_mask_rot(scale)
45ad345e31 FREESCAPE: Added mising override keyword
a4ba0f1761 QDENGINE: Fixes in grTileAnimation::drawFrame() sprite positions
cea335530d QDENGINE: Fix qdAnimation::draw_mask(scale)
419db876c2 QDENGINE: Fixes to qdAnimation::draw_mask_rot(scale)
68531b9c8c QDENGINE: Hid bigger debug output for QDA loading deeper
96e8e82d81 QDENGINE: Added more debug output for QDA dumping
06a88ea6bc QDENGINE: Get rid of _yTable in grDispatcher
b5d1ef3f9e JANITORIAL: Indentation fixes


Commit: 30033b0674b3195a67f61c1e49311870fd1884f3
    https://github.com/scummvm/scummvm/commit/30033b0674b3195a67f61c1e49311870fd1884f3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Implement qdAnimation::hit() and qdAnimation::hit(scale)

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index db3cc7a17ea..b245739ca3b 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -546,14 +546,19 @@ bool qdAnimation::hit(int x, int y) const {
 	int xx = x;
 	int yy = y;
 
-	const qdAnimationFrame *p = get_cur_frame();
-	if (p) {
-		if (check_flag(QD_ANIMATION_FLAG_FLIP_HORIZONTAL))
-			xx = -x;
-		if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
-			yy = -y;
+	if (check_flag(QD_ANIMATION_FLAG_FLIP_HORIZONTAL))
+		xx = -x;
+	if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
+		yy = -y;
 
-		return p->hit(xx, yy);
+	if (tileAnimation()) {
+		Vect2i pos(xx, yy);
+
+		return tileAnimation()->hit(get_cur_frame_number(), pos);
+	} else {
+		const qdAnimationFrame *p = get_cur_frame();
+		if (p)
+			return p->hit(xx, yy);
 	}
 
 	return false;
@@ -563,14 +568,19 @@ bool qdAnimation::hit(int x, int y, float scale) const {
 	int xx = x;
 	int yy = y;
 
-	const qdAnimationFrame *p = get_cur_frame();
-	if (p) {
-		if (check_flag(QD_ANIMATION_FLAG_FLIP_HORIZONTAL))
-			xx = -x;
-		if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
-			yy = -y;
+	if (check_flag(QD_ANIMATION_FLAG_FLIP_HORIZONTAL))
+		xx = -x;
+	if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
+		yy = -y;
 
-		return p->hit(xx, yy, scale);
+	if (tileAnimation()) {
+		Vect2i pos(xx, yy);
+
+		return tileAnimation()->hit(get_cur_frame_number(), pos); // Weirdly, but there is no _scale variant
+	} else {
+		const qdAnimationFrame *p = get_cur_frame();
+		if (p)
+			return p->hit(xx, yy, scale);
 	}
 
 	return false;
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 7fb5ee610ee..e80c6543093 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -355,6 +355,22 @@ void grTileAnimation::drawFrame(const Vect2i &position, int frame_index, float a
 ////  New version 105 & 106 code
 //////////////////////////////////////////////////////////////////////
 
+grTileSprite grTileAnimation::getFrameTile(int frame_number, int tile_index) const {
+	return getTile(_frameIndex[tile_index + frame_number * _frameTileSize.x * _frameTileSize.y]);
+}
+
+bool grTileAnimation::hit(int frame_number, Vect2i &pos) const {
+	int x = _frameSize.x / 2 + pos.x;
+	int y = _frameSize.y / 2 + pos.y;
+
+	if (x < 0 || x >= _frameSize.x || y < 0 || y >= _frameSize.y)
+		return false;
+
+	const byte *tile = (const byte *)getFrameTile(frame_number, x / 16 + y / 16 * _frameTileSize.x).data();
+
+	return tile[64 * (y % 16) + 4 * (x % 16) + 3] < 0xC8u;
+}
+
 void grTileAnimation::drawFrame_scale(const Vect2i &position, int frame_index, float scale, int mode) const {
 	int closest_scale = find_closest_scale(&scale);
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index f9faf4d71d6..e96c0d621c5 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -70,6 +70,7 @@ public:
 	bool compress(grTileCompressionMethod method);
 
 	grTileSprite getTile(int tile_index) const;
+	grTileSprite getFrameTile(int frame_number, int tile_index) const;
 
 	void addFrame(const uint32 *frame_data);
 
@@ -87,6 +88,8 @@ public:
 	void drawContour(const Vect2i &position, int frame_index, uint32 color, int mode, int closest_scale) const;
 	void drawContour(const Vect2i &position, int frame_index, uint32 color, float scale, int mode) const;
 
+	bool hit(int frame_number, Vect2i &pos) const;
+
 	static void setProgressHandler(CompressionProgressHandler handler, void *context) {
 		_progressHandler = handler;
 		_progressHandlerContext = context;


Commit: 682e6418a5391783cb76ae3ecb93b39dc426e155
    https://github.com/scummvm/scummvm/commit/682e6418a5391783cb76ae3ecb93b39dc426e155
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Finish implementation of qdAnimation::redraw(scale)

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index b245739ca3b..cd3881a0935 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -168,11 +168,20 @@ void qdAnimation::redraw(int x, int y, int z, float scale, int mode) const {
 	if (check_flag(QD_ANIMATION_FLAG_BLACK_FON))
 		mode |= GR_BLACK_FON;
 
-	if (tileAnimation())
+	if (tileAnimation()) {
 		tileAnimation()->drawFrame_scale(Vect2i(x, y), get_cur_frame_number(), scale, mode);
+	} else {
+		const qdAnimationFrame *scaled_frame;
+		int scale_index = get_scale_index(scale);
+
+		if (scale_index == -1)
+			scaled_frame = get_cur_frame();
+		else
+			scaled_frame = get_scaled_frame(get_cur_frame_number(), scale_index);
 
-	if (const qdAnimationFrame *p = get_cur_frame(scale))
-		p->redraw(x, y, z, scale, mode);
+		if (scaled_frame)
+			scaled_frame->redraw_rot(x, y, z, scale, mode);
+	}
 }
 
 void qdAnimation::redraw_rot(int x, int y, int z, float angle, int mode) const {


Commit: f954bcf3b223eaeb9958f0bb4600820d6646f472
    https://github.com/scummvm/scummvm/commit/f954bcf3b223eaeb9958f0bb4600820d6646f472
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Implement code differences for qdAnimation::draw_mask_rot(scale)

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index cd3881a0935..28364738385 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -305,8 +305,30 @@ void qdAnimation::draw_mask_rot(int x, int y, int z, float angle, uint32 mask_co
 	if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
 		mode |= GR_FLIP_VERTICAL;
 
-	if (const qdAnimationFrame *p = get_cur_frame())
-		p->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, scale, mode);
+	if (tileAnimation()) {
+		tileAnimation()->drawMask_rot(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, angle, mode);
+	} else if (fabs(scale.x - scale.y) >= 0.01f) {
+		if (const qdAnimationFrame *p = get_cur_frame())
+			p->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, scale, mode);
+	} else {
+		const qdAnimationFrame *scaled_frame;
+		float newScale = scale.x;
+		int scale_index = get_scale_index(newScale);
+
+		if (scale_index == -1) {
+			scaled_frame = get_cur_frame();
+		} else {
+			scaled_frame = get_scaled_frame(get_cur_frame_number(), scale_index);
+		}
+
+		if (scaled_frame) {
+			if (fabs(newScale - 1.0) >= 0.01) {
+				scaled_frame->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, Vect2f(newScale, newScale), mode);
+			} else {
+				scaled_frame->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, mode);
+			}
+		}
+	}
 }
 
 void qdAnimation::draw_contour(int x, int y, uint32 color) const {


Commit: 45ad345e31abf953427b03892a5187eb8b326471
    https://github.com/scummvm/scummvm/commit/45ad345e31abf953427b03892a5187eb8b326471
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
FREESCAPE: Added mising override keyword

Changed paths:
    engines/freescape/games/castle/castle.h


diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index a36843346a5..135e42eb498 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -55,7 +55,7 @@ public:
 
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawZXUI(Graphics::Surface *surface) override;
-	void drawAmigaAtariSTUI(Graphics::Surface *surface);
+	void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
 	void drawEnergyMeter(Graphics::Surface *surface);
 	void pressedKey(const int keycode) override;
 	void checkSensors() override;


Commit: a4ba0f176120f0d7fde912678c39c1e9ebf3fdf9
    https://github.com/scummvm/scummvm/commit/a4ba0f176120f0d7fde912678c39c1e9ebf3fdf9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Fixes in grTileAnimation::drawFrame() sprite positions

Changed paths:
    engines/qdengine/system/graphics/gr_tile_animation.cpp


diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index e80c6543093..0e85689b757 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -341,14 +341,16 @@ void grTileAnimation::drawFrame(const Vect2i &position, int32 frame_index, int32
 
 void grTileAnimation::drawFrame(const Vect2i &position, int frame_index, float angle, int mode) const {
 	byte *buf = decode_frame_data(frame_index, -1);
+	Vect2i pos = position - _frameSize / 2;
 
-	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle);
+	grDispatcher::instance()->putSpr_rot(pos, _frameSize, buf, _hasAlpha, mode, angle);
 }
 
 void grTileAnimation::drawFrame(const Vect2i &position, int frame_index, float angle, const Vect2f &scale, int mode) const {
 	byte *buf = decode_frame_data(frame_index, -1);
+	Vect2i pos = position - _frameSize / 2;
 
-	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle, scale);
+	grDispatcher::instance()->putSpr_rot(pos, _frameSize, buf, _hasAlpha, mode, angle, scale);
 }
 
 //////////////////////////////////////////////////////////////////////


Commit: cea335530de37a3cbedffa5f327312be1a610e84
    https://github.com/scummvm/scummvm/commit/cea335530de37a3cbedffa5f327312be1a610e84
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Fix qdAnimation::draw_mask(scale)

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index 28364738385..9530c3cbd87 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -265,7 +265,7 @@ void qdAnimation::draw_mask(int x, int y, int z, uint32 mask_color, int mask_alp
 		mode |= GR_BLACK_FON;
 
 	if (tileAnimation()) {
-		tileAnimation()->drawMask(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, scale, mode);
+		tileAnimation()->drawMask_scale(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, scale, mode);
 	} else {
 		int scale_index = get_scale_index(scale);
 		const qdAnimationFrame *scaled_frame;
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 0e85689b757..67c5121a4af 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -408,6 +408,28 @@ void grTileAnimation::drawMask(const Vect2i &pos, int frame_index, uint32 mask_c
 	grDispatcher::instance()->putSprMask_a(pos.x - frameSize.x / 2, pos.y - frameSize.y / 2, frameSize.x, frameSize.y, buf, mask_colour, mask_alpha, mode);
 }
 
+void grTileAnimation::drawMask_scale(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float scale, int mode) const {
+	int closest_scale = find_closest_scale(&scale);
+
+	if (wasFrameSizeChanged(frame_index, closest_scale, scale)) {
+		byte *buf = decode_frame_data(frame_index, closest_scale);
+
+		Vect2i frameSize;
+
+		if (closest_scale == -1)
+			frameSize = _frameSize;
+		else
+			frameSize =_scaleArray[closest_scale]._frameSize;
+
+		int x = pos.x - (int)((float)(frameSize.x / 2) * scale);
+		int y = pos.y - (int)((float)(frameSize.y / 2) * scale);
+
+		grDispatcher::instance()->putSprMask_a(x, y, frameSize.x, frameSize.y, buf, mask_colour, mask_alpha, mode, scale);
+	} else {
+		drawMask(pos, frame_index, mask_colour, mask_alpha, mode, closest_scale);
+	}
+}
+
 void grTileAnimation::drawMask_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, int mode) const {
 	byte *buf = decode_frame_data(frame_index, -1);
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index e96c0d621c5..0486f68af01 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -83,6 +83,7 @@ public:
 	void drawFrame_scale(const Vect2i &position, int frame_index, float scale, int mode) const;
 
 	void drawMask(const Vect2i &position, int frame_index, uint32 mask_color, int mask_alpha, int mode, int closest_scale) const;
+	void drawMask_scale(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float scale, int mode) const;
 	void drawMask_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, int mode) const;
 
 	void drawContour(const Vect2i &position, int frame_index, uint32 color, int mode, int closest_scale) const;


Commit: 419db876c2be481720434b8291629667257dcad7
    https://github.com/scummvm/scummvm/commit/419db876c2be481720434b8291629667257dcad7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:27+02:00

Commit Message:
QDENGINE: Fixes to qdAnimation::draw_mask_rot(scale)

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index 9530c3cbd87..82a4a06d492 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -306,7 +306,7 @@ void qdAnimation::draw_mask_rot(int x, int y, int z, float angle, uint32 mask_co
 		mode |= GR_FLIP_VERTICAL;
 
 	if (tileAnimation()) {
-		tileAnimation()->drawMask_rot(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, angle, mode);
+		tileAnimation()->drawMask_rot(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, angle, scale, mode);
 	} else if (fabs(scale.x - scale.y) >= 0.01f) {
 		if (const qdAnimationFrame *p = get_cur_frame())
 			p->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, scale, mode);
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 67c5121a4af..065cc0caf9b 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -436,6 +436,15 @@ void grTileAnimation::drawMask_rot(const Vect2i &pos, int frame_index, uint32 ma
 	grDispatcher::instance()->putSprMask_rot(Vect2i(pos.x - _frameSize.x / 2, pos.y - _frameSize.y / 2), _frameSize, buf, _hasAlpha, mask_colour, mask_alpha, mode, angle);
 }
 
+void grTileAnimation::drawMask_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, Vect2f scale, int mode) const {
+	byte *buf = decode_frame_data(frame_index, -1);
+
+	int x = pos.x - (int)((float)(_frameSize.x / 2) * scale.x);
+	int y = pos.y - (int)((float)(_frameSize.y / 2) * scale.y);
+
+	grDispatcher::instance()->putSprMask_rot(Vect2i(x, y), _frameSize, buf, _hasAlpha, mask_colour, mask_alpha, mode, angle, scale);
+}
+
 void grTileAnimation::drawContour(const Vect2i &pos, int frame_index, uint32 color, int mode, int closest_scale) const {
 	Vect2i frameSize;
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 0486f68af01..25a3d777d98 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -85,6 +85,7 @@ public:
 	void drawMask(const Vect2i &position, int frame_index, uint32 mask_color, int mask_alpha, int mode, int closest_scale) const;
 	void drawMask_scale(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float scale, int mode) const;
 	void drawMask_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, int mode) const;
+	void drawMask_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, Vect2f scale, int mode) const;
 
 	void drawContour(const Vect2i &position, int frame_index, uint32 color, int mode, int closest_scale) const;
 	void drawContour(const Vect2i &position, int frame_index, uint32 color, float scale, int mode) const;


Commit: 68531b9c8c972c5425579fde28faa9c1be667380
    https://github.com/scummvm/scummvm/commit/68531b9c8c972c5425579fde28faa9c1be667380
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:28+02:00

Commit Message:
QDENGINE: Hid bigger debug output for QDA loading deeper

Changed paths:
    engines/qdengine/system/graphics/gr_tile_animation.cpp


diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 065cc0caf9b..215964255c8 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -257,15 +257,15 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 	_frameIndex.resize(size);
 	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _frameIndex size: %u", (int)fh->pos() - 4, size);
 
-	debugCN(dL + 1, kDebugLoad, "   ");
+	debugCN(dL + 2, kDebugLoad, "   ");
 	for (uint i = 0; i < size; i++) {
 		_frameIndex[i] = fh->readUint32LE();
-		debugCN(dL + 1, kDebugLoad, " %5d ", _frameIndex[i]);
+		debugCN(dL + 2, kDebugLoad, " %5d ", _frameIndex[i]);
 
 		if ((i + 1) % 20 == 0)
-			debugCN(dL + 1, kDebugLoad, "\n   ");
+			debugCN(dL + 2, kDebugLoad, "\n   ");
 	}
-	debugCN(dL + 1, kDebugLoad, "\n");
+	debugCN(dL + 2, kDebugLoad, "\n");
 
 	size = fh->readUint32LE();
 
@@ -273,15 +273,15 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 
 	_tileOffsets.resize(size);
 
-	debugCN(dL, kDebugLoad, "   ");
+	debugCN(dL + 2, kDebugLoad, "   ");
 	for (uint i = 0; i < size; i++) {
 		_tileOffsets[i] = fh->readUint32LE();
-		debugCN(dL + 1, kDebugLoad, " %6d ", _tileOffsets[i]);
+		debugCN(dL + 2, kDebugLoad, " %6d ", _tileOffsets[i]);
 
 		if ((i + 1) % 20 == 0)
-			debugCN(dL + 1, kDebugLoad, "\n   ");
+			debugCN(dL + 2, kDebugLoad, "\n   ");
 	}
-	debugCN(dL + 1, kDebugLoad, "\n");
+	debugCN(dL + 2, kDebugLoad, "\n");
 
 	size = fh->readUint32LE();
 


Commit: 96e8e82d814be7ae43acd9d6bf4297f604738e8a
    https://github.com/scummvm/scummvm/commit/96e8e82d814be7ae43acd9d6bf4297f604738e8a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:28+02:00

Commit Message:
QDENGINE: Added more debug output for QDA dumping

Changed paths:
    engines/qdengine/qdengine.cpp


diff --git a/engines/qdengine/qdengine.cpp b/engines/qdengine/qdengine.cpp
index 8a12714bc7d..a41e42549d5 100644
--- a/engines/qdengine/qdengine.cpp
+++ b/engines/qdengine/qdengine.cpp
@@ -479,6 +479,8 @@ void restore_graphics() {
 }
 
 void scan_qda() {
+	debug("======== QDA Scan start ========");
+
 	for (int i = 0; i < 3; i++) {
 		Common::Archive *archive = qdFileManager::instance().get_package(i);
 		Common::ArchiveMemberList members;
@@ -517,6 +519,8 @@ void scan_qda() {
 			}
 		}
 	}
+
+	debug("======== QDA Scan end ========");
 }
 
 } // namespace QDEngine


Commit: 06a88ea6bccb5f3faf6220a5c2df541d077d20ab
    https://github.com/scummvm/scummvm/commit/06a88ea6bccb5f3faf6220a5c2df541d077d20ab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:16:28+02:00

Commit Message:
QDENGINE: Get rid of _yTable in grDispatcher

Changed paths:
    engines/qdengine/system/graphics/gr_dispatcher.cpp
    engines/qdengine/system/graphics/gr_dispatcher.h
    engines/qdengine/system/graphics/gr_draw_sprite.cpp
    engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp


diff --git a/engines/qdengine/system/graphics/gr_dispatcher.cpp b/engines/qdengine/system/graphics/gr_dispatcher.cpp
index 2624deebf30..b966250d1cf 100644
--- a/engines/qdengine/system/graphics/gr_dispatcher.cpp
+++ b/engines/qdengine/system/graphics/gr_dispatcher.cpp
@@ -51,7 +51,6 @@ grDispatcher::grDispatcher() : _screenBuf(NULL),
 	zbuffer_(NULL),
 #endif
 	_hWnd(NULL),
-	_yTable(NULL),
 	_temp_buffer(0) {
 	_flags = 0;
 
@@ -91,8 +90,6 @@ bool grDispatcher::finit() {
 	_wndPosX = _wndPosY = 0;
 	delete _realScreenBuf;
 	_realScreenBuf = nullptr;
-	delete  _yTable;
-	_yTable = NULL;
 
 	return true;
 }
diff --git a/engines/qdengine/system/graphics/gr_dispatcher.h b/engines/qdengine/system/graphics/gr_dispatcher.h
index fdf055c0043..9d95e8af922 100644
--- a/engines/qdengine/system/graphics/gr_dispatcher.h
+++ b/engines/qdengine/system/graphics/gr_dispatcher.h
@@ -501,8 +501,6 @@ protected:
 	Graphics::ManagedSurface *_screenBuf = nullptr;
 	Graphics::ManagedSurface *_realScreenBuf = nullptr;
 
-	int *_yTable;
-
 	char *_temp_buffer;
 	int _temp_buffer_size;
 
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite.cpp b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
index d8aa24c0e74..778dbf43e80 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
@@ -230,7 +230,7 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 
 	if (has_alpha) {
 		for (int y = 0; y <= sy; y++) {
-					uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 					int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + ((size.x + 1 + dx) << (F_PREC - 1));
 					int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + ((size.y + 1 + dy) << (F_PREC - 1));
@@ -264,7 +264,7 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 				}
 	} else {
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + ((size.x + 1 + dx) << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + ((size.y + 1 + dy) << (F_PREC - 1));
@@ -319,7 +319,7 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 
 	if (has_alpha) {
 		for (int y = 0; y <= sy; y++) {
-					uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 					int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
 					int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
@@ -353,7 +353,7 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 				}
 	} else {
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
@@ -407,7 +407,7 @@ void grDispatcher::putSprMask_rot(const Vect2i &pos, const Vect2i &size, const b
 		split_rgb565u(mask_color, mr, mg, mb);
 
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + (size.x + 1) * (1 << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + (size.y + 1) * (1 << (F_PREC - 1));
@@ -456,7 +456,7 @@ void grDispatcher::putSprMask_rot(const Vect2i &pos, const Vect2i &size, const b
 		uint32 mcl = make_rgb565u(mr, mg, mb);
 
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + (size.x + 1) * (1 << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + (size.y + 1) * (1 << (F_PREC - 1));
@@ -515,7 +515,7 @@ void grDispatcher::putSprMask_rot(const Vect2i &pos, const Vect2i &size, const b
 		split_rgb565u(mask_color, mr, mg, mb);
 
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
@@ -561,7 +561,7 @@ void grDispatcher::putSprMask_rot(const Vect2i &pos, const Vect2i &size, const b
 		mb = (mb * (255 - mask_alpha)) >> 8;
 
 		for (int y = 0; y <= sy; y++) {
-			uint16 *screen_ptr = (uint16 *)(_screenBuf + _yTable[y + y0] + x0 * 2);
+			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
 			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
 			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
index 0d74aed3005..3bb1396d2f0 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
@@ -623,8 +623,8 @@ void grDispatcher::drawSprContour(int x, int y, int sx, int sy, const class RLEB
 
 	warning("STUB: grDispatcher::drawSprContour");
 	for (int i = 0; i < psy; i++) {
-		uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
-		uint16 *scr_buf_prev = (i) ? reinterpret_cast<uint16 *>(_screenBuf + _yTable[y - dy] + x) : scr_buf;
+		uint16 *scr_buf = (uint16 *)_screenBuf->getBasePtr(x, y);
+		uint16 *scr_buf_prev = (i) ? (uint16 *)_screenBuf->getBasePtr(x, y - dy) : scr_buf;
 		p->decode_line(py + i, i & 1);
 
 		const uint16 *data_ptr = (i & 1) ? data1 + px : data0 + px;
@@ -680,7 +680,7 @@ void grDispatcher::drawSprContour(int x, int y, int sx, int sy, const class RLEB
 
 		y += dy;
 	}
-	uint16 *scr_buf_prev = reinterpret_cast<uint16 *>(_screenBuf + _yTable[y - dy] + x);
+	uint16 *scr_buf_prev = (uint16 *)_screenBuf->getBasePtr(x, y - dy);
 	const uint16 *data_ptr_prev = (psy & 1) ? data0 + px : data1 + px;
 	if (!alpha_flag) {
 		for (int j = 0; j < psx; j += 2) {


Commit: b5d1ef3f9e797b1de908b18d58967811c502bc7d
    https://github.com/scummvm/scummvm/commit/b5d1ef3f9e797b1de908b18d58967811c502bc7d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T16:19:09+02:00

Commit Message:
JANITORIAL: Indentation fixes

Changed paths:
    engines/qdengine/system/graphics/gr_draw_sprite.cpp
    engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp


diff --git a/engines/qdengine/system/graphics/gr_draw_sprite.cpp b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
index 778dbf43e80..e1410f0f918 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite.cpp
@@ -232,36 +232,36 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 		for (int y = 0; y <= sy; y++) {
 			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
-					int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + ((size.x + 1 + dx) << (F_PREC - 1));
-					int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + ((size.y + 1 + dy) << (F_PREC - 1));
-
-					for (int x = 0; x <= sx; x++) {
-						int xb = (xx >> F_PREC);
-						int yb = (yy >> F_PREC);
-
-						if (xb >= 0 && xb < size.x && yb >= 0 && yb < size.y) {
-							if (mode & GR_FLIP_HORIZONTAL)
-								xb = size.x - xb - 1;
-							if (mode & GR_FLIP_VERTICAL)
-								yb = size.y - yb - 1;
-
-							const byte *data_ptr = data + size.x * 4 * yb + xb * 4;
-
-							uint32 a = data_ptr[3];
-							if (a != 255) {
-								if (a)
-									*screen_ptr = alpha_blend_565(make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]), *screen_ptr, a);
-								else
-									*screen_ptr = make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]);
-							}
-						}
-
-						xx += cos_a;
-						yy -= sin_a;
-
-						screen_ptr++;
+			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + ((size.x + 1 + dx) << (F_PREC - 1));
+			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + ((size.y + 1 + dy) << (F_PREC - 1));
+
+			for (int x = 0; x <= sx; x++) {
+				int xb = (xx >> F_PREC);
+				int yb = (yy >> F_PREC);
+
+				if (xb >= 0 && xb < size.x && yb >= 0 && yb < size.y) {
+					if (mode & GR_FLIP_HORIZONTAL)
+						xb = size.x - xb - 1;
+					if (mode & GR_FLIP_VERTICAL)
+						yb = size.y - yb - 1;
+
+					const byte *data_ptr = data + size.x * 4 * yb + xb * 4;
+
+					uint32 a = data_ptr[3];
+					if (a != 255) {
+						if (a)
+							*screen_ptr = alpha_blend_565(make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]), *screen_ptr, a);
+						else
+							*screen_ptr = make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]);
 					}
 				}
+
+				xx += cos_a;
+				yy -= sin_a;
+
+				screen_ptr++;
+			}
+		}
 	} else {
 		for (int y = 0; y <= sy; y++) {
 			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
@@ -321,36 +321,36 @@ void grDispatcher::putSpr_rot(const Vect2i &pos, const Vect2i &size, const byte
 		for (int y = 0; y <= sy; y++) {
 			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
 
-					int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
-					int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
-
-					for (int x = 0; x <= sx; x++) {
-						int xb = xx / iscale.x;
-						int yb = yy / iscale.y;
-
-						if (xb >= 0 && xb < size.x && yb >= 0 && yb < size.y) {
-							if (mode & GR_FLIP_HORIZONTAL)
-								xb = size.x - xb - 1;
-							if (mode & GR_FLIP_VERTICAL)
-								yb = size.y - yb - 1;
+			int xx = (x0 - xc) * cos_a + (y + y0 - yc) * sin_a + scaled_size.x / 2 + (1 << (F_PREC - 1));
+			int yy = (y + y0 - yc) * cos_a - (x0 - xc) * sin_a + scaled_size.y / 2 + (1 << (F_PREC - 1));
 
-							const byte *data_ptr = data + size.x * 4 * yb + xb * 4;
+			for (int x = 0; x <= sx; x++) {
+				int xb = xx / iscale.x;
+				int yb = yy / iscale.y;
 
-							uint32 a = data_ptr[3];
-							if (a != 255) {
-								if (a)
-									*screen_ptr = alpha_blend_565(make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]), *screen_ptr, a);
-								else
-									*screen_ptr = make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]);
-							}
-						}
+				if (xb >= 0 && xb < size.x && yb >= 0 && yb < size.y) {
+					if (mode & GR_FLIP_HORIZONTAL)
+						xb = size.x - xb - 1;
+					if (mode & GR_FLIP_VERTICAL)
+						yb = size.y - yb - 1;
 
-						xx += cos_a;
-						yy -= sin_a;
+					const byte *data_ptr = data + size.x * 4 * yb + xb * 4;
 
-						screen_ptr++;
+					uint32 a = data_ptr[3];
+					if (a != 255) {
+						if (a)
+							*screen_ptr = alpha_blend_565(make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]), *screen_ptr, a);
+						else
+							*screen_ptr = make_rgb565u(data_ptr[2], data_ptr[1], data_ptr[0]);
 					}
 				}
+
+				xx += cos_a;
+				yy -= sin_a;
+
+				screen_ptr++;
+			}
+		}
 	} else {
 		for (int y = 0; y <= sy; y++) {
 			uint16 *screen_ptr = (uint16 *)_screenBuf->getBasePtr(x0, y + y0);
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
index 3bb1396d2f0..5546ce344bd 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
@@ -480,7 +480,7 @@ void grDispatcher::putSprMask_rle(int x, int y, int sx, int sy, const RLEBuffer
 				fx += dx;
 			}
 		}
-		}
+	}
 }
 
 void grDispatcher::putSpr_rle_rot(const Vect2i &pos, const Vect2i &size, const RLEBuffer *data, bool has_alpha, int mode, float angle) {




More information about the Scummvm-git-logs mailing list