[Scummvm-git-logs] scummvm master -> 4ad5e51016c5c2e9e1061608809515c02b4c70fc

tag2015 noreply at scummvm.org
Tue May 23 12:42:33 UTC 2023


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

Summary:
4ad5e51016 AGS: Engine: fixed wrong mask upscale for low-res rooms in hi-res game


Commit: 4ad5e51016c5c2e9e1061608809515c02b4c70fc
    https://github.com/scummvm/scummvm/commit/4ad5e51016c5c2e9e1061608809515c02b4c70fc
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-05-23T13:47:28+02:00

Commit Message:
AGS: Engine: fixed wrong mask upscale for low-res rooms in hi-res game

Instead of "physically" resizing masks we should adjust MaskResolution factor, used when converting coordinates.
This also relates to the situations when the low-res game is run in "upscale" mode (e.g. 320x200 -> 640x400).

This fixes lowered walking speed (#2004).
This is a (hopefully) proper alternative to an older fix 900f47b , and 60d79d1 (see #1383).
>From upstream 1b4117a6d2bc9e5a70739d7d73ab77e616320fdb

Changed paths:
    engines/ags/engine/ac/room.cpp


diff --git a/engines/ags/engine/ac/room.cpp b/engines/ags/engine/ac/room.cpp
index 2d285691065..ddf4ee0e378 100644
--- a/engines/ags/engine/ac/room.cpp
+++ b/engines/ags/engine/ac/room.cpp
@@ -188,9 +188,8 @@ void convert_room_background_to_game_res() {
 	if (!_GP(game).AllowRelativeRes() || !_GP(thisroom).IsRelativeRes())
 		return;
 
-	int bkg_width = _GP(thisroom).Width;
-	int bkg_height = _GP(thisroom).Height;
-	data_to_game_coords(&bkg_width, &bkg_height);
+	const int bkg_width = data_to_game_coord(_GP(thisroom).Width);
+	const int bkg_height = data_to_game_coord(_GP(thisroom).Height);
 
 	for (size_t i = 0; i < _GP(thisroom).BgFrameCount; ++i)
 		_GP(thisroom).BgFrames[i].Graphic = FixBitmap(_GP(thisroom).BgFrames[i].Graphic, bkg_width, bkg_height);
@@ -198,19 +197,11 @@ void convert_room_background_to_game_res() {
 	// Fix masks to match resized room background
 	// Walk-behind is always 1:1 with room background size
 	_GP(thisroom).WalkBehindMask = FixBitmap(_GP(thisroom).WalkBehindMask, bkg_width, bkg_height);
-	int mask_width = bkg_width / _GP(thisroom).MaskResolution;
-	int mask_height = bkg_height / _GP(thisroom).MaskResolution;
-	_GP(thisroom).HotspotMask = FixBitmap(_GP(thisroom).HotspotMask, mask_width, mask_height);
-	_GP(thisroom).RegionMask = FixBitmap(_GP(thisroom).RegionMask, mask_width, mask_height);
-	_GP(thisroom).WalkAreaMask = FixBitmap(_GP(thisroom).WalkAreaMask, mask_width, mask_height);
-
-	for (size_t i = 0; i < _GP(thisroom).WalkAreaCount; ++i) {
-		_GP(thisroom).WalkAreas[i].Top = room_to_mask_coord(_GP(thisroom).WalkAreas[i].Top);
-		_GP(thisroom).WalkAreas[i].Bottom = room_to_mask_coord(_GP(thisroom).WalkAreas[i].Bottom);
-	}
+	// For the rest we keep the masks at original res, but update the MaskResolution,
+	// as it must correspond to the runtime data->game coordinate conversion
+	_GP(thisroom).MaskResolution = data_to_game_coord(_GP(thisroom).MaskResolution);
 }
 
-
 void save_room_data_segment() {
 	_G(croom)->FreeScriptData();
 




More information about the Scummvm-git-logs mailing list