[Scummvm-git-logs] scummvm master -> 539bbd39641287bd8551670833840657d84ee9b0

sev- noreply at scummvm.org
Sat Sep 7 23:27:10 UTC 2024


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:
42a83214e1 QDENGINE: Implement drawing of individual frame tiles
97952b256a QDENGINE: Fix grTileAnimation::decode_frame_data(). This fixes animations in shveik
44d16f1593 QDENGINE: Added code differences to qdAnimation::redraw_rot(scale)
e5c7162218 QDENGINE: Implemented code differences in qdAnimation::draw_mask()
b472c3bc7a QDENGINE: Implement code differences in qdAnimation::draw_mask(scale)
ebda20a6fc QDENGINE: Implemented code differences for qdAnimation::draw_mask_rot()
090e3470d4 QDENGINE: Implemented code differences in qdAnimation::draw_contour() and scale variant
539bbd3964 QDENGINE: Force file offsets to be 'int' in debug messages


Commit: 42a83214e1db2c0a02ca92d804be2ad9d5b77e9f
    https://github.com/scummvm/scummvm/commit/42a83214e1db2c0a02ca92d804be2ad9d5b77e9f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:38+02:00

Commit Message:
QDENGINE: Implement drawing of individual frame tiles

Changed paths:
    engines/qdengine/debugger/debugtools.cpp
    engines/qdengine/system/graphics/gr_tile_animation.cpp
    engines/qdengine/system/graphics/gr_tile_animation.h


diff --git a/engines/qdengine/debugger/debugtools.cpp b/engines/qdengine/debugger/debugtools.cpp
index eec4d174163..3357afa3777 100644
--- a/engines/qdengine/debugger/debugtools.cpp
+++ b/engines/qdengine/debugger/debugtools.cpp
@@ -44,7 +44,7 @@
 
 namespace QDEngine {
 
-const int TILES_ID = -10;
+const int TILES_ID = -1337;
 
 ImGuiState *_state = nullptr;
 
@@ -85,7 +85,21 @@ ImGuiImage getImageID(Common::Path filename, int frameNum) {
 	int sx = 10, sy = 10;
 	Graphics::ManagedSurface *surface = nullptr;
 
-	if (frameNum != TILES_ID) {
+	if (frameNum == TILES_ID) {
+		if (animation->tileAnimation()) {
+			surface = animation->tileAnimation()->dumpTiles(25);
+
+			sx = surface->w;
+			sy = surface->h;
+		}
+	} else if (frameNum < 0) { // Tiles
+		if (animation->tileAnimation()) {
+			surface = animation->tileAnimation()->dumpFrameTiles(-frameNum + 1, 0.91670);
+
+			sx = surface->w;
+			sy = surface->h;
+		}
+	} else {
 		if (animation->tileAnimation()) {
 			Vect2i size = animation->tileAnimation()->frameSize();
 
@@ -105,15 +119,8 @@ ImGuiImage getImageID(Common::Path filename, int frameNum) {
 		animation->set_cur_frame(frameNum);
 
 		grDispatcher::instance()->surfaceOverride(surface);
-		animation->redraw(sx / 2, sy/ 2, 0, 0);
+		animation->redraw(sx / 2, sy / 2, 0, 0.91670, 0);
 		grDispatcher::instance()->resetSurfaceOverride();
-	} else {
-		if (animation->tileAnimation()) {
-			surface = animation->tileAnimation()->dumpTiles(25);
-
-			sx = surface->w;
-			sy = surface->h;
-		}
 	}
 
 	if (surface)
@@ -255,6 +262,12 @@ void showArchives() {
 						ImGui::InvisibleButton("##canvas", ImVec2(32.f, 32.f));
 					}
 
+					ImGui::SameLine();
+
+					imgID = getImageID(_state->_qdaToDisplay, -_state->_qdaToDisplayFrame - 1);
+
+					showImage(imgID, (char *)transCyrillic(_state->_qdaToDisplay.toString()), 2.0);
+
 					ImGui::EndTabItem();
 				}
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index dfdf0ab9b29..221faf626ff 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -475,6 +475,55 @@ bool grTileAnimation::wasFrameSizeChanged(int frame_index, int scaleIdx, float s
 	return true;
 }
 
+Graphics::ManagedSurface *grTileAnimation::dumpFrameTiles(int frame_index, float scale) const {
+	int closest_scale = find_closest_scale(&scale);
+
+	Vect2i frameSize;
+
+	if (closest_scale == -1)
+		frameSize = _frameSize;
+	else
+		frameSize = _scaleArray[closest_scale]._frameSize;
+
+	Vect2i frameTileSize;
+	if (closest_scale == -1)
+		frameTileSize = _frameTileSize;
+	else
+		frameTileSize = _scaleArray[closest_scale]._frameTileSize;
+
+	int frameStart;
+	if (closest_scale == -1)
+		frameStart = 0;
+	else
+		frameStart = _scaleArray[closest_scale]._frameStart;
+
+	int w = frameTileSize.x * (GR_TILE_SPRITE_SIZE_X + 1);
+	int h = frameTileSize.y * (GR_TILE_SPRITE_SIZE_Y + 1);
+
+	Graphics::ManagedSurface *dstSurf = new Graphics::ManagedSurface(w, h, g_engine->_pixelformat);
+
+	const uint32 *index_ptr = &_frameIndex[frameStart] + frameTileSize.x * frameTileSize.y * frame_index;
+
+	for (int i = 0; i < frameTileSize.y; i++) {
+		for (int j = 0; j < frameTileSize.x; j++) {
+			const byte *src = (const byte *)getTile(*index_ptr++).data();
+
+			for (int yy = 0; yy < GR_TILE_SPRITE_SIZE_Y; yy++) {
+				uint16 *dst = (uint16 *)dstSurf->getBasePtr(j * (GR_TILE_SPRITE_SIZE_X + 1), i * (GR_TILE_SPRITE_SIZE_Y + 1) + yy);
+
+				for (int xx = 0; xx < GR_TILE_SPRITE_SIZE_X; xx++) {
+					*dst = grDispatcher::instance()->make_rgb565u(src[2], src[1], src[0]);
+					dst++;
+					src += 4;
+				}
+			}
+		}
+	}
+
+	return dstSurf;
+}
+
+
 Graphics::ManagedSurface *grTileAnimation::dumpTiles(int tilesPerRow) const {
 	int w = tilesPerRow;
 	int h = (_tileOffsets.size() + tilesPerRow - 1) / tilesPerRow;
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 31736cd8edc..cb496a44006 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -92,6 +92,8 @@ public:
 	Graphics::ManagedSurface *dumpTiles(int tilesPerRow) const;
 	void dumpTiles(Common::Path baseName, int tilesPerRow) const;
 
+	Graphics::ManagedSurface *dumpFrameTiles(int frame_index, float scale) const;
+
 private:
 
 	grTileCompressionMethod _compression;


Commit: 97952b256aac8739577b349c964a14e33a935232
    https://github.com/scummvm/scummvm/commit/97952b256aac8739577b349c964a14e33a935232
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:38+02:00

Commit Message:
QDENGINE: Fix grTileAnimation::decode_frame_data(). This fixes animations in shveik

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 221faf626ff..37c8f80c422 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -426,10 +426,12 @@ byte *grTileAnimation::decode_frame_data(int frame_index, int closest_scale) con
 
 	for (int i = 0; i < frameTileSize.y; i++) {
 		for (int j = 0; j < frameTileSize.x; j++) {
-			byte *buf_ptr = buf + (i * frameSize.x + j) * 4;
+			byte *buf_ptr = buf + (i * frameSize.x * GR_TILE_SPRITE_SIZE_Y + j * GR_TILE_SPRITE_SIZE_X) * 4;
+
 			const byte *data_ptr = (const byte *)getTile(*index_ptr++).data();
 			int dx = MIN(frameSize.x - j * GR_TILE_SPRITE_SIZE_X, GR_TILE_SPRITE_SIZE_X) * 4;
-			for (int k = 0; k < GR_TILE_SPRITE_SIZE_Y; k++) {
+			int dy = MIN(frameSize.y - i * GR_TILE_SPRITE_SIZE_Y, GR_TILE_SPRITE_SIZE_Y);
+			for (int k = 0; k < dy; k++) {
 				memcpy(buf_ptr, data_ptr, dx);
 				data_ptr += GR_TILE_SPRITE_SIZE_X * 4;
 				buf_ptr += frameSize.x * 4;


Commit: 44d16f1593b39befb65d78b531ce0b405b1dd5d2
    https://github.com/scummvm/scummvm/commit/44d16f1593b39befb65d78b531ce0b405b1dd5d2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:38+02:00

Commit Message:
QDENGINE: Added code differences to qdAnimation::redraw_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 9e99558e88e..fbfc209406c 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -200,8 +200,28 @@ void qdAnimation::redraw_rot(int x, int y, int z, float angle, const Vect2f &sca
 	if (check_flag(QD_ANIMATION_FLAG_FLIP_VERTICAL))
 		mode |= GR_FLIP_VERTICAL;
 
-	if (const qdAnimationFrame *p = get_cur_frame())
-		p->redraw_rot(x, y, z, angle, scale, mode);
+	if (tileAnimation()) {
+		tileAnimation()->drawFrame(Vect2i(x, y), get_cur_frame_number(), angle, scale, mode);
+	} else if (fabs(scale.x - scale.y) < 0.01f) {
+		if (const qdAnimationFrame *p = get_cur_frame())
+			p->redraw_rot(x, y, z, angle, 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.01f)
+				scaled_frame->redraw_rot(x, y, z, angle, Vect2f(newScale, newScale), mode);
+			else
+				scaled_frame->redraw_rot(x, y, z, angle, mode);
+		}
+	}
 }
 
 void qdAnimation::draw_mask(int x, int y, int z, uint32 mask_color, int mask_alpha, int mode) const {
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 37c8f80c422..677fc68094c 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -340,24 +340,15 @@ 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 = (byte *)grDispatcher::instance()->temp_buffer(_frameSize.x * _frameSize.y * 4);
+	byte *buf = decode_frame_data(frame_index, -1);
 
-	const uint32 *index_ptr = &_frameIndex[0] + _frameTileSize.x * _frameTileSize.y * frame_index;
+	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle);
+}
 
-	for (int i = 0; i < _frameTileSize.y; i++) {
-		for (int j = 0; j < _frameTileSize.x; j++) {
-			byte *buf_ptr = buf + (i * _frameSize.x + j) * 4;
-			const byte *data_ptr = (const byte *)getTile(*index_ptr++).data();
-			int dx = MIN(_frameSize.x - j * GR_TILE_SPRITE_SIZE_X, GR_TILE_SPRITE_SIZE_X) * 4;
-			for (int k = 0; k < GR_TILE_SPRITE_SIZE_Y; k++) {
-				memcpy(buf_ptr, data_ptr, dx);
-				data_ptr += GR_TILE_SPRITE_SIZE_X * 4;
-				buf_ptr += _frameSize.x * 4;
-			}
-		}
-	}
+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);
 
-	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle);
+	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle, scale);
 }
 
 void grTileAnimation::drawFrame_scale(const Vect2i &position, int frame_index, float scale, int mode) const {
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index cb496a44006..8a73cff866d 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -77,6 +77,8 @@ public:
 
 	void drawFrame(const Vect2i &position, int32 frame_index, int32 mode, int closest_scale) const;
 	void drawFrame(const Vect2i &position, int frame_index, float angle, int mode = 0) const;
+	void drawFrame(const Vect2i &position, int frame_index, float angle, const Vect2f &scale, int mode) const;
+
 	void drawFrame_scale(const Vect2i &position, int frame_index, float scale, int mode) const;
 
 	static void setProgressHandler(CompressionProgressHandler handler, void *context) {


Commit: e5c71622181423975bac4c37aead9e50ae76ee43
    https://github.com/scummvm/scummvm/commit/e5c71622181423975bac4c37aead9e50ae76ee43
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:38+02:00

Commit Message:
QDENGINE: Implemented code differences in qdAnimation::draw_mask()

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 fbfc209406c..fb61c26cf82 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -234,7 +234,9 @@ void qdAnimation::draw_mask(int x, int y, int z, uint32 mask_color, int mask_alp
 	if (check_flag(QD_ANIMATION_FLAG_BLACK_FON))
 		mode |= GR_BLACK_FON;
 
-	if (const qdAnimationFrame *p = get_cur_frame())
+	if (tileAnimation())
+		tileAnimation()->drawMask(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, mode, -1);
+	else if (const qdAnimationFrame *p = get_cur_frame())
 		p->draw_mask(x, y, z, mask_color, mask_alpha, mode);
 }
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 677fc68094c..11b53fe6c46 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -351,6 +351,10 @@ void grTileAnimation::drawFrame(const Vect2i &position, int frame_index, float a
 	grDispatcher::instance()->putSpr_rot(position, _frameSize, buf, _hasAlpha, mode, angle, scale);
 }
 
+//////////////////////////////////////////////////////////////////////
+////  New version 105 & 106 code
+//////////////////////////////////////////////////////////////////////
+
 void grTileAnimation::drawFrame_scale(const Vect2i &position, int frame_index, float scale, int mode) const {
 	int closest_scale = find_closest_scale(&scale);
 
@@ -373,9 +377,18 @@ void grTileAnimation::drawFrame_scale(const Vect2i &position, int frame_index, f
 	}
 }
 
-//////////////////////////////////////////////////////////////////////
-////  New version 105 & 106 code
-//////////////////////////////////////////////////////////////////////
+void grTileAnimation::drawMask(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, int mode, int closest_scale) const {
+	Vect2i frameSize;
+
+	if (closest_scale == -1)
+		frameSize = _frameSize;
+	else
+		frameSize =_scaleArray[closest_scale]._frameSize;
+
+	byte *buf = decode_frame_data(frame_index, closest_scale);
+
+	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::addScale(int i, float scale) {
 	_scaleArray[i]._scale = scale;
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 8a73cff866d..3e9af2f9cb0 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -81,6 +81,8 @@ 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;
+
 	static void setProgressHandler(CompressionProgressHandler handler, void *context) {
 		_progressHandler = handler;
 		_progressHandlerContext = context;


Commit: b472c3bc7aaa4a7d2aa63d71f31000cca36cb158
    https://github.com/scummvm/scummvm/commit/b472c3bc7aaa4a7d2aa63d71f31000cca36cb158
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:38+02:00

Commit Message:
QDENGINE: Implement code differences in qdAnimation::draw_mask(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 fb61c26cf82..68d22733dc4 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -255,8 +255,20 @@ void qdAnimation::draw_mask(int x, int y, int z, uint32 mask_color, int mask_alp
 	if (check_flag(QD_ANIMATION_FLAG_BLACK_FON))
 		mode |= GR_BLACK_FON;
 
-	if (const qdAnimationFrame *p = get_cur_frame(scale))
-		p->draw_mask(x, y, z, mask_color, mask_alpha, scale, mode);
+	if (tileAnimation()) {
+		tileAnimation()->drawMask(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;
+
+		if (scale_index == -1)
+			scaled_frame = get_cur_frame();
+		else
+			scaled_frame = get_scaled_frame(get_cur_frame_number(), scale_index);
+
+		if (scaled_frame)
+			scaled_frame->draw_mask(x, y, z, mask_color, mask_alpha, scale, mode);
+	}
 }
 
 void qdAnimation::draw_mask_rot(int x, int y, int z, float angle, uint32 mask_color, int mask_alpha, int mode) const {


Commit: ebda20a6fc051ac24f4fc2d553df251218c53f9a
    https://github.com/scummvm/scummvm/commit/ebda20a6fc051ac24f4fc2d553df251218c53f9a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T00:45:39+02:00

Commit Message:
QDENGINE: Implemented code differences for qdAnimation::draw_mask_rot()

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 68d22733dc4..b4695e37730 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -279,7 +279,7 @@ void qdAnimation::draw_mask_rot(int x, int y, int z, float angle, uint32 mask_co
 		mode |= GR_FLIP_VERTICAL;
 
 	if (tileAnimation()) {
-		tileAnimation()->drawFrame(Vect2i(x, y), get_cur_frame_number(), angle, mode);
+		tileAnimation()->drawMask_rot(Vect2i(x, y), get_cur_frame_number(), mask_color, mask_alpha, angle, mode);
 	} else if (const qdAnimationFrame *p = get_cur_frame())
 		p->draw_mask_rot(x, y, z, angle, mask_color, mask_alpha, mode);
 }
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 11b53fe6c46..1321b5082d6 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -390,6 +390,12 @@ 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_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);
+
+	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::addScale(int i, float scale) {
 	_scaleArray[i]._scale = scale;
 	_scaleArray[i]._frameSize.x = (int)((float)_frameSize.x * scale);
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 3e9af2f9cb0..6826dd6902f 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -82,6 +82,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_rot(const Vect2i &pos, int frame_index, uint32 mask_colour, int mask_alpha, float angle, int mode) const;
 
 	static void setProgressHandler(CompressionProgressHandler handler, void *context) {
 		_progressHandler = handler;


Commit: 090e3470d46a2a0da1ef2cfe2919924c7dfc858e
    https://github.com/scummvm/scummvm/commit/090e3470d46a2a0da1ef2cfe2919924c7dfc858e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T01:10:07+02:00

Commit Message:
QDENGINE: Implemented code differences in qdAnimation::draw_contour() and scale variant

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 b4695e37730..d76c0e902c3 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -312,8 +312,13 @@ void qdAnimation::draw_contour(int x, int y, uint32 color) const {
 	if (check_flag(QD_ANIMATION_FLAG_BLACK_FON))
 		mode |= GR_BLACK_FON;
 
-	const qdAnimationFrame *p = get_cur_frame();
-	if (p) p->draw_contour(x, y, color, mode);
+	if (tileAnimation()) {
+		tileAnimation()->drawContour(Vect2i(x, y), get_cur_frame_number(), color, mode, -1);
+	} else {
+		const qdAnimationFrame *p = get_cur_frame();
+		if (p)
+			p->draw_contour(x, y, color, mode);
+	}
 }
 
 void qdAnimation::draw_contour(int x, int y, uint32 color, float scale) const {
@@ -328,8 +333,16 @@ void qdAnimation::draw_contour(int x, int y, uint32 color, float scale) const {
 	if (check_flag(QD_ANIMATION_FLAG_BLACK_FON))
 		mode |= GR_BLACK_FON;
 
-	const qdAnimationFrame *p = get_cur_frame();
-	if (p) p->draw_contour(x, y, color, scale, mode);
+	if (tileAnimation()) {
+		if (fabs(scale - 1.0) >= 0.01f)
+			tileAnimation()->drawContour(Vect2i(x, y), get_cur_frame_number(), color, scale, mode);
+		else
+			tileAnimation()->drawContour(Vect2i(x, y), get_cur_frame_number(), color, mode, -1);
+	} else {
+		const qdAnimationFrame *p = get_cur_frame();
+		if (p)
+			p->draw_contour(x, y, color, scale, mode);
+	}
 }
 
 qdAnimationFrame *qdAnimation::get_cur_frame() {
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 1321b5082d6..9f56ab4f4c8 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -396,6 +396,41 @@ 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::drawContour(const Vect2i &pos, int frame_index, uint32 color, int mode, int closest_scale) const {
+	Vect2i frameSize;
+
+	if (closest_scale == -1)
+		frameSize = _frameSize;
+	else
+		frameSize =_scaleArray[closest_scale]._frameSize;
+
+	byte *buf = decode_frame_data(frame_index, closest_scale);
+
+	grDispatcher::instance()->drawSprContour_a(pos.x - frameSize.x / 2, pos.y - frameSize.y / 2, frameSize.x, frameSize.y, buf, color, mode);
+}
+
+void grTileAnimation::drawContour(const Vect2i &pos, int frame_index, uint32 color, float scale, int mode) const {
+	int closest_scale = find_closest_scale(&scale);
+
+	if (wasFrameSizeChanged(frame_index, closest_scale, scale)) {
+		byte *data = 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()->drawSprContour_a(x, y, frameSize.x, frameSize.y, data, color, mode, scale);
+	} else {
+		drawContour(pos, frame_index, color, mode, closest_scale);
+	}
+}
+
 void grTileAnimation::addScale(int i, float scale) {
 	_scaleArray[i]._scale = scale;
 	_scaleArray[i]._frameSize.x = (int)((float)_frameSize.x * scale);
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.h b/engines/qdengine/system/graphics/gr_tile_animation.h
index 6826dd6902f..f9faf4d71d6 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.h
+++ b/engines/qdengine/system/graphics/gr_tile_animation.h
@@ -84,6 +84,9 @@ public:
 	void drawMask(const Vect2i &position, int frame_index, uint32 mask_color, int mask_alpha, int mode, int closest_scale) 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;
+	void drawContour(const Vect2i &position, int frame_index, uint32 color, float scale, int mode) const;
+
 	static void setProgressHandler(CompressionProgressHandler handler, void *context) {
 		_progressHandler = handler;
 		_progressHandlerContext = context;


Commit: 539bbd39641287bd8551670833840657d84ee9b0
    https://github.com/scummvm/scummvm/commit/539bbd39641287bd8551670833840657d84ee9b0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-08T01:25:32+02:00

Commit Message:
QDENGINE: Force file offsets to be 'int' in debug messages

This fixes annpying portability issue, generating tons of warnings,
since printing int64s is still platform-dependent.

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/qdcore/qd_camera.cpp
    engines/qdengine/qdcore/qd_camera_mode.cpp
    engines/qdengine/qdcore/qd_condition.cpp
    engines/qdengine/qdcore/qd_conditional_object.cpp
    engines/qdengine/qdcore/qd_coords_animation.cpp
    engines/qdengine/qdcore/qd_counter.cpp
    engines/qdengine/qdcore/qd_game_dispatcher.cpp
    engines/qdengine/qdcore/qd_game_object.cpp
    engines/qdengine/qdcore/qd_game_object_animated.cpp
    engines/qdengine/qdcore/qd_game_object_mouse.cpp
    engines/qdengine/qdcore/qd_game_object_moving.cpp
    engines/qdengine/qdcore/qd_game_object_state.cpp
    engines/qdengine/qdcore/qd_game_scene.cpp
    engines/qdengine/qdcore/qd_grid_zone.cpp
    engines/qdengine/qdcore/qd_inventory.cpp
    engines/qdengine/qdcore/qd_inventory_cell.cpp
    engines/qdengine/qdcore/qd_named_object_reference.cpp
    engines/qdengine/qdcore/qd_trigger_chain.cpp
    engines/qdengine/qdcore/qd_trigger_element.cpp
    engines/qdengine/system/graphics/gr_tile_animation.cpp


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index d76c0e902c3..db3cc7a17ea 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -948,7 +948,7 @@ Vect2i qdAnimation::remove_edges() {
 }
 
 bool qdAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdAnimation::load_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdAnimation::load_data(): before: %d", (int)fh.pos());
 
 	if (!qdNamedObject::load_data(fh, save_version))
 		return false;
@@ -985,12 +985,12 @@ bool qdAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
 	_status = st;
 	_is_finished = (finished) ? true : false;
 
-	debugC(2, kDebugSave, "  qdAnimation::load_data(): after %ld", fh.pos());
+	debugC(2, kDebugSave, "  qdAnimation::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdAnimation::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdAnimation::save_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdAnimation::save_data(): before: %d", (int)fh.pos());
 
 	if (!qdNamedObject::save_data(fh)) return false;
 
@@ -1008,7 +1008,7 @@ bool qdAnimation::save_data(Common::WriteStream &fh) const {
 	fh.writeFloatLE(_cur_time);
 	fh.writeFloatLE(_length);
 
-	debugC(3, kDebugSave, "  qdAnimation::save_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdAnimation::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_camera.cpp b/engines/qdengine/qdcore/qd_camera.cpp
index 2efa372dfe7..a8eebaca3d7 100644
--- a/engines/qdengine/qdcore/qd_camera.cpp
+++ b/engines/qdengine/qdcore/qd_camera.cpp
@@ -942,7 +942,7 @@ const sGridCell *qdCamera::get_cell(const Vect2s &cell_pos) const {
 }
 
 bool qdCamera::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdCamera::load_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCamera::load_data(): before: %d", (int)fh.pos());
 
 	int x, y;
 	char flag;
@@ -977,12 +977,12 @@ bool qdCamera::load_data(Common::SeekableReadStream &fh, int save_version) {
 		_default_object = dynamic_cast<qdGameObjectAnimated *>(qdGameDispatcher::get_dispatcher()->get_named_object(&ref));
 	}
 
-	debugC(3, kDebugSave, "  qdCamera::load_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCamera::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdCamera::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdCamera::save_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCamera::save_data(): before: %d", (int)fh.pos());
 	fh.writeSint32LE(_scrCenter.x);
 	fh.writeSint32LE(_scrCenter.y);
 	fh.writeSint32LE(_GSX);
@@ -1009,7 +1009,7 @@ bool qdCamera::save_data(Common::WriteStream &fh) const {
 		fh.writeByte(char(0));
 	}
 
-	debugC(3, kDebugSave, "  qdCamera::save_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCamera::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_camera_mode.cpp b/engines/qdengine/qdcore/qd_camera_mode.cpp
index 0e82c3d46db..b2e2027d5df 100644
--- a/engines/qdengine/qdcore/qd_camera_mode.cpp
+++ b/engines/qdengine/qdcore/qd_camera_mode.cpp
@@ -94,7 +94,7 @@ bool qdCameraMode::save_script(Common::WriteStream &fh, int indent) const {
 }
 
 bool qdCameraMode::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdCameraMode::load_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCameraMode::load_data(): before: %d", (int)fh.pos());
 	/*int mode = */fh.readSint32LE();
 	_work_time = fh.readFloatLE();
 	_scrolling_speed = fh.readFloatLE();
@@ -104,13 +104,13 @@ bool qdCameraMode::load_data(Common::SeekableReadStream &fh, int save_version) {
 
 	char switch_flag = fh.readByte();
 	_smooth_switch = (switch_flag) ? true : false;
-	debugC(4, kDebugSave, "    qdCameraMode::load_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCameraMode::load_data(): after: %d", (int)fh.pos());
 
 	return true;
 }
 
 bool qdCameraMode::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdCameraMode::save_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCameraMode::save_data(): before: %d", (int)fh.pos());
 
 	fh.writeSint32LE((int)_camera_mode);
 	fh.writeFloatLE(_work_time);
@@ -126,7 +126,7 @@ bool qdCameraMode::save_data(Common::WriteStream &fh) const {
 		fh.writeByte(0);
 	}
 
-	debugC(4, kDebugSave, "    qdCameraMode::save_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCameraMode::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_condition.cpp b/engines/qdengine/qdcore/qd_condition.cpp
index e092b4279ab..f54569b6c58 100644
--- a/engines/qdengine/qdcore/qd_condition.cpp
+++ b/engines/qdengine/qdcore/qd_condition.cpp
@@ -404,7 +404,7 @@ void qdCondition::quant(float dt) {
 }
 
 bool qdCondition::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(5, kDebugSave, "      qdCondition::load_data(): before %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdCondition::load_data(): before: %d", (int)fh.pos());
 	if (_type == CONDITION_TIMER) {
 		int state;
 		float timer;
@@ -416,12 +416,12 @@ bool qdCondition::load_data(Common::SeekableReadStream &fh, int save_version) {
 		if (!put_value(TIMER_RND, state, 1)) return false;
 	}
 
-	debugC(5, kDebugSave, "      qdCondition::load_data(): after %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdCondition::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdCondition::save_data(Common::WriteStream &fh) const {
-	debugC(5, kDebugSave, "      qdCondition::save_data(): before %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdCondition::save_data(): before: %d", (int)fh.pos());
 	if (_type == CONDITION_TIMER) {
 		float timer;
 		if (!get_value(TIMER_PERIOD, timer, 1)) {
@@ -437,7 +437,7 @@ bool qdCondition::save_data(Common::WriteStream &fh) const {
 		fh.writeSint32LE(state);
 	}
 
-	debugC(5, kDebugSave, "      qdCondition::save_data(): after %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdCondition::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_conditional_object.cpp b/engines/qdengine/qdcore/qd_conditional_object.cpp
index 5a436a02400..357fdbc06b5 100644
--- a/engines/qdengine/qdcore/qd_conditional_object.cpp
+++ b/engines/qdengine/qdcore/qd_conditional_object.cpp
@@ -198,19 +198,19 @@ void qdConditionalObject::conditions_quant(float dt) {
 }
 
 bool qdConditionalObject::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdConditionalObject::load_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdConditionalObject::load_data(): before: %d", (int)fh.pos());
 	if (!qdNamedObject::load_data(fh, save_version))
 		return false;
 
 	for (auto &it : _conditions)
 		it.load_data(fh, save_version);
 
-	debugC(4, kDebugSave, "    qdConditionalObject::load_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdConditionalObject::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdConditionalObject::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdConditionalObject::save_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdConditionalObject::save_data(): before: %d", (int)fh.pos());
 	if (!qdNamedObject::save_data(fh)) {
 		return false;
 	}
@@ -218,7 +218,7 @@ bool qdConditionalObject::save_data(Common::WriteStream &fh) const {
 	for (auto &it : _conditions)
 		it.save_data(fh);
 
-	debugC(4, kDebugSave, "    qdConditionalObject::save_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdConditionalObject::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_coords_animation.cpp b/engines/qdengine/qdcore/qd_coords_animation.cpp
index 2c5a703b916..ab81315aacc 100644
--- a/engines/qdengine/qdcore/qd_coords_animation.cpp
+++ b/engines/qdengine/qdcore/qd_coords_animation.cpp
@@ -415,7 +415,7 @@ void qdCoordsAnimation::set_time_rel(float tm) {
 }
 
 bool qdCoordsAnimation::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdCoordsAnimation::load_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCoordsAnimation::load_data(): before: %d", (int)fh.pos());
 
 	if (!qdNamedObject::load_data(fh, save_version)) return false;
 
@@ -449,12 +449,12 @@ bool qdCoordsAnimation::load_data(Common::SeekableReadStream &fh, int save_versi
 	vec.z = fh.readFloatLE();
 	_start_point.set_dest_pos(vec);
 
-	debugC(4, kDebugSave, "    qdCoordsAnimation::load_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCoordsAnimation::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdCoordsAnimation::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdCoordsAnimation::save_data(): before %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCoordsAnimation::save_data(): before: %d", (int)fh.pos());
 	if (!qdNamedObject::save_data(fh)) return false;
 
 	fh.writeSint32LE(static_cast<int>(_status));
@@ -474,7 +474,7 @@ bool qdCoordsAnimation::save_data(Common::WriteStream &fh) const {
 	fh.writeFloatLE(_start_point.dest_pos().x);
 	fh.writeFloatLE(_start_point.dest_pos().y);
 	fh.writeFloatLE(_start_point.dest_pos().z);
-	debugC(4, kDebugSave, "    qdCoordsAnimation::save_data(): after %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdCoordsAnimation::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 } // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_counter.cpp b/engines/qdengine/qdcore/qd_counter.cpp
index 1383d354560..4862faded08 100644
--- a/engines/qdengine/qdcore/qd_counter.cpp
+++ b/engines/qdengine/qdcore/qd_counter.cpp
@@ -270,7 +270,7 @@ bool qdCounter::save_script(Common::WriteStream &fh, int indent) const {
 }
 
 bool qdCounter::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdCounter::load_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCounter::load_data(): before: %d", (int)fh.pos());
 	int sz;
 	_value = fh.readSint32LE();
 	sz = fh.readSint32LE();
@@ -281,12 +281,12 @@ bool qdCounter::load_data(Common::SeekableReadStream &fh, int save_version) {
 	for (auto &it : _elements)
 		it.load_data(fh, save_version);
 
-	debugC(3, kDebugSave, "  qdCounter::load_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCounter::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdCounter::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdCounter::save_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCounter::save_data(): before: %d", (int)fh.pos());
 	fh.writeSint32LE(_value);
 	fh.writeSint32LE(_elements.size());
 
@@ -294,7 +294,7 @@ bool qdCounter::save_data(Common::WriteStream &fh) const {
 		it.save_data(fh);
 	}
 
-	debugC(3, kDebugSave, "  qdCounter::save_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdCounter::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.cpp b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
index 10f95e39dce..f6279b36cfb 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
@@ -2450,11 +2450,11 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 
 	if (!ref.load_data(*fh, save_version)) return false;
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): active_scene %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): active_scene %d", (int)fh->pos());
 	qdGameScene *cur_scene_ptr = static_cast<qdGameScene *>(get_named_object(&ref));
 	select_scene(0, false);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): music %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): music %d", (int)fh->pos());
 	if (!ref.load_data(*fh, save_version)) return false;
 	if (qdMusicTrack *p = static_cast<qdMusicTrack *>(get_named_object(&ref))) {
 		_cur_music_track = 0;
@@ -2467,7 +2467,7 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 	else
 		toggle_inventory(false);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): object_list 1 %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): object_list 1 %d", (int)fh->pos());
 	uint32 size = fh->readUint32LE();
 	if (size != global_object_list().size()) return false;
 
@@ -2476,7 +2476,7 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 			return false;
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): counter_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): counter_list %d", (int)fh->pos());
 	size = fh->readUint32LE();
 	if (size != counter_list().size()) return false;
 
@@ -2485,19 +2485,19 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 			return false;
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): scene_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): scene_list %d", (int)fh->pos());
 	size = fh->readUint32LE();
 	if (size != scene_list().size()) return false;
 
-	debugC(3, kDebugLog, "Scene list size: %u pos: %ld", scene_list().size(), fh->pos());
+	debugC(3, kDebugLog, "Scene list size: %u pos: %d", scene_list().size(), (int)fh->pos());
 	for (auto &it : scene_list()) {
 		if (!it->load_data(*fh, save_version))
 			return false;
 	}
 
-	debugC(3, kDebugLog, "Global object list size: %u pos: %ld", global_object_list().size(), fh->pos());
+	debugC(3, kDebugLog, "Global object list size: %u pos: %d", global_object_list().size(), (int)fh->pos());
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): object_list 2 %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): object_list 2 %d", (int)fh->pos());
 	size = fh->readSint32LE();
 	if (size != global_object_list().size()) return false;
 
@@ -2506,7 +2506,7 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 			return false;
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): trigger_chain_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): trigger_chain_list %d", (int)fh->pos());
 	size = fh->readSint32LE();
 	if (size != trigger_chain_list().size()) return false;
 
@@ -2515,7 +2515,7 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 			return false;
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): inventory_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): inventory_list %d", (int)fh->pos());
 	size = fh->readSint32LE();
 	if (size != inventory_list().size()) return false;
 
@@ -2524,11 +2524,11 @@ bool qdGameDispatcher::load_save(Common::SeekableReadStream *fh) {
 			return false;
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): mouse_obj %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): mouse_obj %d", (int)fh->pos());
 	if (save_version >= 10)
 		_mouse_obj->load_data(*fh, save_version);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): TOTAL SIZE %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::load_save(): TOTAL SIZE %d", (int)fh->pos());
 
 	if (cur_scene_ptr)
 		select_scene(cur_scene_ptr, false);
@@ -2550,7 +2550,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 	const int32 save_version = 107;
 	fh->writeUint32LE(save_version);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): active_scene %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): active_scene %d", (int)fh->pos());
 	if (get_active_scene()) {
 		qdNamedObjectReference ref(get_active_scene());
 		if (!ref.save_data(*fh)) {
@@ -2563,7 +2563,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): music %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): music %d", (int)fh->pos());
 	if (_cur_music_track) {
 		qdNamedObjectReference ref(_cur_music_track);
 		if (!ref.save_data(*fh)) {
@@ -2581,7 +2581,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 	else
 		fh->writeSint32LE(0);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): object_list 1 %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): object_list 1 %d", (int)fh->pos());
 	fh->writeUint32LE(global_object_list().size());
 	for (auto &it : global_object_list()) {
 		if (!it->save_data(*fh)) {
@@ -2589,7 +2589,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): counter_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): counter_list %d", (int)fh->pos());
 	fh->writeUint32LE(counter_list().size());
 	for (auto &it : counter_list()) {
 		if (!it->save_data(*fh)) {
@@ -2597,17 +2597,17 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): scene_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): scene_list %d", (int)fh->pos());
 	fh->writeUint32LE(scene_list().size());
-	debugC(3, kDebugLog, "Scene list size: %u pos: %ld", scene_list().size(), fh->pos());
+	debugC(3, kDebugLog, "Scene list size: %u pos: %d", scene_list().size(), (int)fh->pos());
 	for (auto &it : scene_list()) {
 		if (!it->save_data(*fh))
 			return false;
 	}
 
-	debugC(3, kDebugLog, "Global object list size: %u pos: %ld", global_object_list().size(), fh->pos());
+	debugC(3, kDebugLog, "Global object list size: %u pos: %d", global_object_list().size(), (int)fh->pos());
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): object_list 2 %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): object_list 2 %d", (int)fh->pos());
 	fh->writeUint32LE(global_object_list().size());
 	for (auto &it : global_object_list()) {
 		if (!it->save_data(*fh)) {
@@ -2615,7 +2615,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): trigger_chain_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): trigger_chain_list %d", (int)fh->pos());
 	fh->writeUint32LE(trigger_chain_list().size());
 	for (auto &it : trigger_chain_list()) {
 		if (!it->save_data(*fh)) {
@@ -2623,7 +2623,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): inventory_list %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): inventory_list %d", (int)fh->pos());
 	fh->writeUint32LE(inventory_list().size());
 	for (auto &it : inventory_list()) {
 		if (!it->save_data(*fh)) {
@@ -2631,10 +2631,10 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
 		}
 	}
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): mouse_obj %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): mouse_obj %d", (int)fh->pos());
 	_mouse_obj->save_data(*fh);
 
-	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): TOTAL SIZE %ld", fh->pos());
+	debugC(2, kDebugSave, "qdGameDispatcher::save_save(): TOTAL SIZE %d", (int)fh->pos());
 
 	return true;
 }
diff --git a/engines/qdengine/qdcore/qd_game_object.cpp b/engines/qdengine/qdcore/qd_game_object.cpp
index 01b0d77a7f6..2835d9b300f 100644
--- a/engines/qdengine/qdcore/qd_game_object.cpp
+++ b/engines/qdengine/qdcore/qd_game_object.cpp
@@ -150,7 +150,7 @@ bool qdGameObject::update_screen_pos() {
 }
 
 bool qdGameObject::load_data(Common::SeekableReadStream &fh, int saveVersion) {
-	debugC(3, kDebugSave, "  qdGameObject::load_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObject::load_data(): before: %d", (int)fh.pos());
 
 	if (!qdNamedObject::load_data(fh, saveVersion)) {
 		return false;
@@ -160,12 +160,12 @@ bool qdGameObject::load_data(Common::SeekableReadStream &fh, int saveVersion) {
 	_r.y = fh.readFloatLE();
 	_r.z = fh.readFloatLE();
 
-	debugC(3, kDebugSave, "  qdGameObject::load_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObject::load_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdGameObject::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGameObject::save_data(): before %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObject::save_data(): before: %d", (int)fh.pos());
 	if (!qdNamedObject::save_data(fh)) {
 		return false;
 	}
@@ -174,7 +174,7 @@ bool qdGameObject::save_data(Common::WriteStream &fh) const {
 	fh.writeFloatLE(_r.y);
 	fh.writeFloatLE(_r.z);
 
-	debugC(3, kDebugSave, "  qdGameObject::save_data(): after %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObject::save_data(): after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_object_animated.cpp b/engines/qdengine/qdcore/qd_game_object_animated.cpp
index b2514bbb6d2..e2f2a8a6892 100644
--- a/engines/qdengine/qdcore/qd_game_object_animated.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_animated.cpp
@@ -1251,7 +1251,7 @@ int qdGameObjectAnimated::get_state_index(const qdGameObjectState *p) const {
 }
 
 bool qdGameObjectAnimated::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdGameObjectAnimated::load_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdGameObjectAnimated::load_data before: %d", (int)fh.pos());
 	if (!qdGameObject::load_data(fh, save_version)) return false;
 
 	_cur_state = fh.readSint32LE();
@@ -1286,13 +1286,13 @@ bool qdGameObjectAnimated::load_data(Common::SeekableReadStream &fh, int save_ve
 	_inventory_cell_index = fh.readSint32LE();
 	_last_chg_time = fh.readUint32LE();
 
-	debugC(4, kDebugSave, "    qdGameObjectAnimated::load_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdGameObjectAnimated::load_data after: %d", (int)fh.pos());
 
 	return true;
 }
 
 bool qdGameObjectAnimated::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdGameObjectAnimated::save_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdGameObjectAnimated::save_data before: %d", (int)fh.pos());
 	if (!qdGameObject::save_data(fh)) return false;
 
 	fh.writeSint32LE(_cur_state);
@@ -1323,7 +1323,7 @@ bool qdGameObjectAnimated::save_data(Common::WriteStream &fh) const {
 
 	fh.writeSint32LE(_last_chg_time);
 
-	debugC(4, kDebugSave, "    qdGameObjectAnimated::save_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdGameObjectAnimated::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_object_mouse.cpp b/engines/qdengine/qdcore/qd_game_object_mouse.cpp
index 8a7ed1ed9c7..62ea3d6d03c 100644
--- a/engines/qdengine/qdcore/qd_game_object_mouse.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_mouse.cpp
@@ -124,7 +124,7 @@ bool qdGameObjectMouse::save_script(Common::WriteStream &fh, int indent) const {
 }
 
 bool qdGameObjectMouse::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdGameObjectMouse::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMouse::load_data before: %d", (int)fh.pos());
 	if (!qdGameObjectAnimated::load_data(fh, save_version))
 		return false;
 
@@ -141,12 +141,12 @@ bool qdGameObjectMouse::load_data(Common::SeekableReadStream &fh, int save_versi
 		if (!_object) return false;
 	}
 
-	debugC(3, kDebugSave, "  qdGameObjectMouse::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMouse::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdGameObjectMouse::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGameObjectMouse::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMouse::save_data before: %d", (int)fh.pos());
 
 	if (!qdGameObjectAnimated::save_data(fh))
 		return false;
@@ -161,7 +161,7 @@ bool qdGameObjectMouse::save_data(Common::WriteStream &fh) const {
 		fh.writeUint32LE(0);
 	}
 
-	debugC(3, kDebugSave, "  qdGameObjectMouse::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMouse::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_object_moving.cpp b/engines/qdengine/qdcore/qd_game_object_moving.cpp
index 3ff9f3e2021..6428979d552 100644
--- a/engines/qdengine/qdcore/qd_game_object_moving.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_moving.cpp
@@ -1742,7 +1742,7 @@ void qdGameObjectMoving::split(qdGameObjectMoving *p) {
 }
 
 bool qdGameObjectMoving::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdGameObjectMoving::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMoving::load_data before: %d", (int)fh.pos());
 	if (!qdGameObjectAnimated::load_data(fh, save_version)) return false;
 
 	int idx = fh.readSint32LE();
@@ -1805,12 +1805,12 @@ bool qdGameObjectMoving::load_data(Common::SeekableReadStream &fh, int save_vers
 		                            qdGameDispatcher::get_dispatcher()->get_named_object(&circ_ref)));
 	}
 
-	debugC(3, kDebugSave, "  qdGameObjectMoving::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMoving::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdGameObjectMoving::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGameObjectMoving::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMoving::save_data before: %d", (int)fh.pos());
 	if (!qdGameObjectAnimated::save_data(fh)) return false;
 
 	int idx = -1;
@@ -1853,7 +1853,7 @@ bool qdGameObjectMoving::save_data(Common::WriteStream &fh) const {
 		circ_ref.save_data(fh);
 	}
 
-	debugC(3, kDebugSave, "  qdGameObjectMoving::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectMoving::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_object_state.cpp b/engines/qdengine/qdcore/qd_game_object_state.cpp
index 2ab06efb15d..45f3a0c1c7c 100644
--- a/engines/qdengine/qdcore/qd_game_object_state.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_state.cpp
@@ -658,7 +658,7 @@ void qdGameObjectState::set_bound(const Vect3f &b) {
 }
 
 bool qdGameObjectState::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdGameObjectState::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectState::load_data before: %d", (int)fh.pos());
 	if (!qdConditionalObject::load_data(fh, save_version)) return false;
 
 	_cur_time = fh.readFloatLE();
@@ -695,12 +695,12 @@ bool qdGameObjectState::load_data(Common::SeekableReadStream &fh, int save_versi
 		}
 	}
 
-	debugC(3, kDebugSave, "  qdGameObjectState::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectState::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdGameObjectState::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGameObjectState::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectState::save_data before: %d", (int)fh.pos());
 	if (!qdConditionalObject::save_data(fh)) return false;
 
 	fh.writeFloatLE(_cur_time);
@@ -732,7 +732,7 @@ bool qdGameObjectState::save_data(Common::WriteStream &fh) const {
 	} else
 		fh.writeByte(0);
 
-	debugC(3, kDebugSave, "  qdGameObjectState::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameObjectState::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_game_scene.cpp b/engines/qdengine/qdcore/qd_game_scene.cpp
index 2fca636cad8..59053f9aa96 100644
--- a/engines/qdengine/qdcore/qd_game_scene.cpp
+++ b/engines/qdengine/qdcore/qd_game_scene.cpp
@@ -754,7 +754,7 @@ bool qdGameScene::is_music_track_in_list(qdMusicTrack *p) const {
 }
 
 bool qdGameScene::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdGameScene::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameScene::load_data before: %d", (int)fh.pos());
 	if (!qdConditionalObject::load_data(fh, save_version)) {
 		return false;
 	}
@@ -762,7 +762,7 @@ bool qdGameScene::load_data(Common::SeekableReadStream &fh, int save_version) {
 	if (!_camera.load_data(fh, save_version))
 		return false;
 
-	debugC(3, kDebugSave, "  qdGameScene::load_data(%u): Loading _objects %ld", object_list().size(), fh.pos());
+	debugC(3, kDebugSave, "  qdGameScene::load_data(%u): Loading _objects %d", object_list().size(), (int)fh.pos());
 	for (auto &it : object_list()) {
 		if (!it->load_data(fh, save_version)) {
 			return false;
@@ -822,13 +822,13 @@ bool qdGameScene::load_data(Common::SeekableReadStream &fh, int save_version) {
 			_minigame->load_game(save_buf, fl, this);
 	}
 
-	debugC(3, kDebugSave, "  qdGameScene::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameScene::load_data after: %d", (int)fh.pos());
 
 	return true;
 }
 
 bool qdGameScene::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGameScene::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameScene::save_data before: %d", (int)fh.pos());
 	if (!qdConditionalObject::save_data(fh)) {
 		return false;
 	}
@@ -837,7 +837,7 @@ bool qdGameScene::save_data(Common::WriteStream &fh) const {
 		return false;
 	}
 
-	debugC(3, kDebugSave, "  qdGameSceen::save_data(%u): Saving _objects %ld", object_list().size(), fh.pos());
+	debugC(3, kDebugSave, "  qdGameSceen::save_data(%u): Saving _objects %d", object_list().size(), (int)fh.pos());
 	for (auto &it : object_list()) {
 		if (!it->save_data(fh)) {
 			return false;
@@ -872,7 +872,7 @@ bool qdGameScene::save_data(Common::WriteStream &fh) const {
 		fh.writeUint32LE(0);
 	}
 
-	debugC(3, kDebugSave, "  qdGameScene::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGameScene::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_grid_zone.cpp b/engines/qdengine/qdcore/qd_grid_zone.cpp
index ad5c409abd5..6e2064eee9b 100644
--- a/engines/qdengine/qdcore/qd_grid_zone.cpp
+++ b/engines/qdengine/qdcore/qd_grid_zone.cpp
@@ -305,7 +305,7 @@ qdGridZoneState *qdGridZone::get_state(const char *state_name) {
 }
 
 bool qdGridZone::load_data(Common::SeekableReadStream &fh, int saveVersion) {
-	debugC(3, kDebugSave, "  qdGridZone::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGridZone::load_data before: %d", (int)fh.pos());
 	if (!qdNamedObject::load_data(fh, saveVersion)) {
 		return false;
 	}
@@ -314,13 +314,13 @@ bool qdGridZone::load_data(Common::SeekableReadStream &fh, int saveVersion) {
 	_update_timer = fh.readSint32LE();
 
 	_state = (st) ? true : false;
-	debugC(3, kDebugSave, "  qdGridZone::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGridZone::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 
 bool qdGridZone::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdGridZone::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGridZone::save_data before: %d", (int)fh.pos());
 	if (!qdNamedObject::save_data(fh)) {
 		return false;
 	}
@@ -328,7 +328,7 @@ bool qdGridZone::save_data(Common::WriteStream &fh) const {
 	fh.writeByte(_state);
 	fh.writeSint32LE(_update_timer);
 
-	debugC(3, kDebugSave, "  qdGridZone::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdGridZone::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_inventory.cpp b/engines/qdengine/qdcore/qd_inventory.cpp
index a4cb575ad00..8b016cae9ee 100644
--- a/engines/qdengine/qdcore/qd_inventory.cpp
+++ b/engines/qdengine/qdcore/qd_inventory.cpp
@@ -322,12 +322,12 @@ bool qdInventory::free_resources() {
 }
 
 bool qdInventory::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(3, kDebugSave, "  qdInventory::load_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdInventory::load_data before: %d", (int)fh.pos());
 	for (auto &it : _cell_sets) {
 		if (!it.load_data(fh, save_version))
 			return false;
 	}
-	debugC(3, kDebugSave, "  qdInventory::load_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdInventory::load_data after: %d", (int)fh.pos());
 
 	debug_log();
 
@@ -335,13 +335,13 @@ bool qdInventory::load_data(Common::SeekableReadStream &fh, int save_version) {
 }
 
 bool qdInventory::save_data(Common::WriteStream &fh) const {
-	debugC(3, kDebugSave, "  qdInventory::save_data before: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdInventory::save_data before: %d", (int)fh.pos());
 	for (auto &it : _cell_sets) {
 		if (!it.save_data(fh)) {
 			return false;
 		}
 	}
-	debugC(3, kDebugSave, "  qdInventory::save_data after: %ld", fh.pos());
+	debugC(3, kDebugSave, "  qdInventory::save_data after: %d", (int)fh.pos());
 
 	return true;
 }
diff --git a/engines/qdengine/qdcore/qd_inventory_cell.cpp b/engines/qdengine/qdcore/qd_inventory_cell.cpp
index ac47bb93b83..5862169c12f 100644
--- a/engines/qdengine/qdcore/qd_inventory_cell.cpp
+++ b/engines/qdengine/qdcore/qd_inventory_cell.cpp
@@ -135,7 +135,7 @@ bool qdInventoryCell::free_resources() {
 }
 
 bool qdInventoryCell::load_data(Common::SeekableReadStream &fh, int saveVersion) {
-	debugC(5, kDebugSave, "      qdInventoryCell::load_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdInventoryCell::load_data before: %d", (int)fh.pos());
 	char flag = fh.readByte();
 
 	if (flag) {
@@ -150,12 +150,12 @@ bool qdInventoryCell::load_data(Common::SeekableReadStream &fh, int saveVersion)
 	} else
 		_object = NULL;
 
-	debugC(5, kDebugSave, "      qdInventoryCell::load_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdInventoryCell::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdInventoryCell::save_data(Common::WriteStream &fh) const {
-	debugC(5, kDebugSave, "      qdInventoryCell::save_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdInventoryCell::save_data before: %d", (int)fh.pos());
 	if (_object) {
 		fh.writeByte(1);
 
@@ -166,7 +166,7 @@ bool qdInventoryCell::save_data(Common::WriteStream &fh) const {
 	} else
 		fh.writeByte(0);
 
-	debugC(5, kDebugSave, "      qdInventoryCell::save_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdInventoryCell::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
@@ -399,7 +399,7 @@ bool qdInventoryCellSet::free_resources() {
 }
 
 bool qdInventoryCellSet::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdInventoryCellSet::load_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdInventoryCellSet::load_data before: %d", (int)fh.pos());
 	if (save_version >= 102) {
 		_additional_cells.x = fh.readSint32LE();
 		_additional_cells.y = fh.readSint32LE();
@@ -409,12 +409,12 @@ bool qdInventoryCellSet::load_data(Common::SeekableReadStream &fh, int save_vers
 			return false;
 	}
 
-	debugC(4, kDebugSave, "    qdInventoryCellSet::load_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdInventoryCellSet::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdInventoryCellSet::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdInventoryCellSet::save_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdInventoryCellSet::save_data before: %d", (int)fh.pos());
 	fh.writeSint32LE(_additional_cells.x);
 	fh.writeSint32LE(_additional_cells.y);
 
@@ -423,7 +423,7 @@ bool qdInventoryCellSet::save_data(Common::WriteStream &fh) const {
 			return false;
 	}
 
-	debugC(4, kDebugSave, "    qdInventoryCellSet::save_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdInventoryCellSet::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_named_object_reference.cpp b/engines/qdengine/qdcore/qd_named_object_reference.cpp
index ccb330ddc68..5bb9ca4198b 100644
--- a/engines/qdengine/qdcore/qd_named_object_reference.cpp
+++ b/engines/qdengine/qdcore/qd_named_object_reference.cpp
@@ -156,7 +156,7 @@ bool qdNamedObjectReference::save_script(Common::WriteStream &fh, int indent) co
 }
 
 bool qdNamedObjectReference::load_data(Common::SeekableReadStream &fh, int version) {
-	debugC(5, kDebugSave, "      qdNamedObjectReference::load_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdNamedObjectReference::load_data before: %d", (int)fh.pos());
 	int nlevels = fh.readSint32LE();
 
 	_object_types.resize(nlevels);
@@ -172,12 +172,12 @@ bool qdNamedObjectReference::load_data(Common::SeekableReadStream &fh, int versi
 		_object_names[i] = str.c_str();
 	}
 
-	debugC(5, kDebugSave, "      qdNamedObjectReference::load_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdNamedObjectReference::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdNamedObjectReference::save_data(Common::WriteStream &fh) const {
-	debugC(5, kDebugSave, "      qdNamedObjectReference::save_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdNamedObjectReference::save_data before: %d", (int)fh.pos());
 	fh.writeSint32LE(num_levels());
 
 	for (int i = 0; i < num_levels(); i++) {
@@ -186,7 +186,7 @@ bool qdNamedObjectReference::save_data(Common::WriteStream &fh) const {
 		fh.writeString(_object_names[i].c_str());
 	}
 
-	debugC(5, kDebugSave, "      qdNamedObjectReference::save_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdNamedObjectReference::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_trigger_chain.cpp b/engines/qdengine/qdcore/qd_trigger_chain.cpp
index ae989749758..851da04014f 100644
--- a/engines/qdengine/qdcore/qd_trigger_chain.cpp
+++ b/engines/qdengine/qdcore/qd_trigger_chain.cpp
@@ -268,7 +268,7 @@ const char *qdTriggerChain::debug_comline() {
 }
 
 bool qdTriggerChain::load_data(Common::SeekableReadStream &fh, int save_version) {
-	debugC(4, kDebugSave, "    qdTriggerChain::load_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdTriggerChain::load_data before: %d", (int)fh.pos());
 	int32 size = fh.readSint32LE();
 
 	if (size != (int)_elements.size()) {
@@ -284,13 +284,13 @@ bool qdTriggerChain::load_data(Common::SeekableReadStream &fh, int save_version)
 			return false;
 		}
 	}
-	debugC(4, kDebugSave, "    qdTriggerChain::load_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdTriggerChain::load_data after: %d", (int)fh.pos());
 
 	return true;
 }
 
 bool qdTriggerChain::save_data(Common::WriteStream &fh) const {
-	debugC(4, kDebugSave, "    qdTriggerChain::save_data before: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdTriggerChain::save_data before: %d", (int)fh.pos());
 	fh.writeUint32LE(_elements.size());
 
 	if (!root_element()->save_data(fh)) {
@@ -303,7 +303,7 @@ bool qdTriggerChain::save_data(Common::WriteStream &fh) const {
 		}
 	}
 
-	debugC(4, kDebugSave, "    qdTriggerChain::save_data after: %ld", fh.pos());
+	debugC(4, kDebugSave, "    qdTriggerChain::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/qdcore/qd_trigger_element.cpp b/engines/qdengine/qdcore/qd_trigger_element.cpp
index 62c57056285..f740eadcb55 100644
--- a/engines/qdengine/qdcore/qd_trigger_element.cpp
+++ b/engines/qdengine/qdcore/qd_trigger_element.cpp
@@ -649,7 +649,7 @@ bool qdTriggerElement::set_parent_link_status(qdTriggerElementConstPtr parent, q
 }
 
 bool qdTriggerElement::load_data(Common::SeekableReadStream &fh, int saveVersion) {
-	debugC(5, kDebugSave, "      qdTriggerElement::load_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdTriggerElement::load_data before: %d", (int)fh.pos());
 	char st = fh.readByte();
 	set_status(ElementStatus(st));
 
@@ -663,12 +663,12 @@ bool qdTriggerElement::load_data(Common::SeekableReadStream &fh, int saveVersion
 		it.set_status(qdTriggerLink::LinkStatus(st));
 	}
 
-	debugC(5, kDebugSave, "      qdTriggerElement::load_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdTriggerElement::load_data after: %d", (int)fh.pos());
 	return true;
 }
 
 bool qdTriggerElement::save_data(Common::WriteStream &fh) const {
-	debugC(5, kDebugSave, "      qdTriggerElement::save_data before: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdTriggerElement::save_data before: %d", (int)fh.pos());
 	/*  switch(_status){
 	    case TRIGGER_EL_INACTIVE:
 	        for(qdTriggerLinkList::const_iterator it = _parents.begin(); it != _parents.end(); ++it){
@@ -704,7 +704,7 @@ bool qdTriggerElement::save_data(Common::WriteStream &fh) const {
 		fh.writeByte(it.status());
 	}
 
-	debugC(5, kDebugSave, "      qdTriggerElement::save_data after: %ld", fh.pos());
+	debugC(5, kDebugSave, "      qdTriggerElement::save_data after: %d", (int)fh.pos());
 	return true;
 }
 
diff --git a/engines/qdengine/system/graphics/gr_tile_animation.cpp b/engines/qdengine/system/graphics/gr_tile_animation.cpp
index 9f56ab4f4c8..7fb5ee610ee 100644
--- a/engines/qdengine/system/graphics/gr_tile_animation.cpp
+++ b/engines/qdengine/system/graphics/gr_tile_animation.cpp
@@ -200,7 +200,7 @@ void grTileAnimation::addFrame(const uint32 *frame_data) {
 bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 	int dL = (version >= 105) ? 2 : 7;
 
-	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos start: %lu", fh->pos());
+	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos start: %d", (int)fh->pos());
 
 	_frameCount = fh->readSint32LE();
 	_frameSize.x = fh->readSint32LE();
@@ -218,7 +218,7 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 		size = fh->readUint32LE();
 		_scaleArray.resize(size);
 
-		debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %ld _scaleArray size: %u", fh->pos() - 4, size);
+		debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _scaleArray size: %u", (int)fh->pos() - 4, size);
 
 		debugCN(dL + 1, kDebugLoad, "   ");
 
@@ -240,7 +240,7 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 		for (int i = 0; i < _frameCount; i++)
 			_frameSizeArray[i] = _frameSize;
 	} else {
-		debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %ld _frameSizeArray size: %u", fh->pos() - 4, _frameCount);
+		debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _frameSizeArray size: %u", (int)fh->pos() - 4, _frameCount);
 
 		debugCN(dL + 1, kDebugLoad, "   ");
 
@@ -255,7 +255,7 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 
 	size = fh->readUint32LE();
 	_frameIndex.resize(size);
-	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %ld _frameIndex size: %u", fh->pos() - 4, size);
+	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _frameIndex size: %u", (int)fh->pos() - 4, size);
 
 	debugCN(dL + 1, kDebugLoad, "   ");
 	for (uint i = 0; i < size; i++) {
@@ -269,7 +269,7 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 
 	size = fh->readUint32LE();
 
-	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %ld _tileOffsets size: %u", fh->pos() - 4, size);
+	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _tileOffsets size: %u", (int)fh->pos() - 4, size);
 
 	_tileOffsets.resize(size);
 
@@ -285,14 +285,14 @@ bool grTileAnimation::load(Common::SeekableReadStream *fh, int version) {
 
 	size = fh->readUint32LE();
 
-	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %ld _tileData size: %u", fh->pos() - 4, size);
+	debugC(dL, kDebugLoad, "grTileAnimation::load(): pos: %d _tileData size: %u", (int)fh->pos() - 4, size);
 
 	_tileData.resize(size);
 
 	for (uint i = 0; i < size; i++)
 		_tileData[i] = fh->readUint32LE();
 
-	debugC(dL + 1, kDebugLoad, "  --> grTileAnimation::load(): pos: %ld remaining: %ld", fh->pos(), fh->size() - fh->pos());
+	debugC(dL + 1, kDebugLoad, "  --> grTileAnimation::load(): pos: %d remaining: %d", (int)fh->pos(), (int)(fh->size() - fh->pos()));
 
 	return true;
 }




More information about the Scummvm-git-logs mailing list