[Scummvm-git-logs] scummvm master -> 0a6991b586a0bb810f2db12cef012f778b29398c

tag2015 noreply at scummvm.org
Sun Aug 20 12:28:58 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:
0a6991b586 AGS: Fix for inventory icons in old games


Commit: 0a6991b586a0bb810f2db12cef012f778b29398c
    https://github.com/scummvm/scummvm/commit/0a6991b586a0bb810f2db12cef012f778b29398c
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-08-20T14:18:15+02:00

Commit Message:
AGS: Fix for inventory icons in old games

This fixes a regression in some old games such as ben jordan 3
Partially from upstream df30fc1edd30d4f334addaf7883286e745dea2c3
(branch 2.6.1)

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


diff --git a/engines/ags/engine/ac/inv_window.cpp b/engines/ags/engine/ac/inv_window.cpp
index 82e4c6f7992..239a0b7a568 100644
--- a/engines/ags/engine/ac/inv_window.cpp
+++ b/engines/ags/engine/ac/inv_window.cpp
@@ -224,11 +224,12 @@ void InventoryScreen::Prepare() {
 	// Fun fact: this fallback does not seem to be intentional, and was a
 	// coincidental result of SpriteCache incorrectly remembering "last seeked
 	// sprite" as 2041/2042/2043 while in fact stream was after sprite 0.
-	if (_GP(spriteset)[2041] == nullptr || _GP(spriteset)[2042] == nullptr || _GP(spriteset)[2043] == nullptr)
+	if (!_GP(spriteset).DoesSpriteExist(2041) || !_GP(spriteset).DoesSpriteExist(2042) || !_GP(spriteset).DoesSpriteExist(2043)) {
 		debug_script_warn("InventoryScreen: one or more of the inventory screen graphics (sprites 2041, 2042, 2043) does not exist, fallback to sprites 0, 1, 2 instead");
-	btn_look_sprite = _GP(spriteset)[2041] != nullptr ? 2041 : 0;
-	btn_select_sprite = _GP(spriteset)[2042] != nullptr ? 2042 : (_GP(spriteset)[1] != nullptr ? 1 : 0);
-	btn_ok_sprite = _GP(spriteset)[2043] != nullptr ? 2043 : (_GP(spriteset)[2] != nullptr ? 2 : 0);
+	}
+	btn_look_sprite = _GP(spriteset).DoesSpriteExist(2041) ? 2041 : 0;
+	btn_select_sprite = _GP(spriteset).DoesSpriteExist(2042) ? 2042 : (_GP(spriteset).DoesSpriteExist(1) ? 1 : 0);
+	btn_ok_sprite = _GP(spriteset).DoesSpriteExist(2043) ? 2043 : (_GP(spriteset).DoesSpriteExist(2) ? 2 : 0);
 
 	break_code = 0;
 }




More information about the Scummvm-git-logs mailing list