aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-09-15 12:05:58 -0500
committerColin Snover2017-09-15 12:08:31 -0500
commitb8af2ca66f3f565ad0d86761d9eac3b69d68c52d (patch)
tree12ff0b9c06e120aa58d858eefb543311c46c72b3
parent3ed7ef57aec38a39d7887a520c8eaf510f19804e (diff)
downloadscummvm-rg350-b8af2ca66f3f565ad0d86761d9eac3b69d68c52d.tar.gz
scummvm-rg350-b8af2ca66f3f565ad0d86761d9eac3b69d68c52d.tar.bz2
scummvm-rg350-b8af2ca66f3f565ad0d86761d9eac3b69d68c52d.zip
SCI32: Fix clipping of inventory items in Phant2
This fixes overlapping of the left arrow in all cases, but the scroll delta and initial offset of inventory items will only be fixed in new games because the affected objects are global objects whose bad properties get persisted into save games. Fixes Trac#10037.
-rw-r--r--engines/sci/engine/script_patches.cpp50
-rw-r--r--engines/sci/graphics/celobj32.cpp3
2 files changed, 49 insertions, 4 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 87eeddf25b..22006575c6 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -126,6 +126,7 @@ static const char *const selectorNameTable[] = {
"setCel", // Phant2
"iconV", // Phant2
"update", // Phant2
+ "xOff", // Phant2
#endif
NULL
};
@@ -175,7 +176,8 @@ enum ScriptPatcherSelectors {
SELECTOR_setSize,
SELECTOR_setCel,
SELECTOR_iconV,
- SELECTOR_update
+ SELECTOR_update,
+ SELECTOR_xOff
#endif
};
@@ -4068,12 +4070,58 @@ static const uint16 phant2BadIconPatch[] = {
PATCH_END
};
+// The left and right arrows move inventory items a pixel more than each
+// inventory item is wide, which causes the inventory to creep to the left by
+// one pixel per scrolled item.
+// Applies to at least: US English
+static const uint16 phant2InvLeftDeltaSignature[] = {
+ SIG_MAGICDWORD,
+ SIG_UINT16(0x42), // delta
+ SIG_UINT16(0x19), // moveDelay
+ SIG_END
+};
+
+static const uint16 phant2InvLeftDeltaPatch[] = {
+ PATCH_UINT16(0x41), // delta
+ PATCH_END
+};
+
+static const uint16 phant2InvRightDeltaSignature[] = {
+ SIG_MAGICDWORD,
+ SIG_UINT16(0xffbe), // delta
+ SIG_UINT16(0x19), // moveDelay
+ SIG_END
+};
+
+static const uint16 phant2InvRightDeltaPatch[] = {
+ PATCH_UINT16(0xffbf), // delta
+ PATCH_END
+};
+
+// The first inventory item is put too far to the right, which causes wide items
+// to get cut off on the right side of the inventory.
+// Applies to at least: US English
+static const uint16 phant2InvOffsetSignature[] = {
+ SIG_MAGICDWORD,
+ 0x35, 0x26, // ldi 38
+ 0x64, SIG_SELECTOR16(xOff), // aTop xOff
+ SIG_END
+};
+
+static const uint16 phant2InvOffsetPatch[] = {
+ 0x35, 0x1d, // ldi 29
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry phantasmagoria2Signatures[] = {
{ true, 0, "slow interface fades", 3, phant2SlowIFadeSignature, phant2SlowIFadePatch },
{ true, 0, "bad arguments to get game version", 1, phant2GetVersionSignature, phant2GetVersionPatch },
{ true, 3000, "replace spin loop in alien password window", 1, phant2WaitParam1Signature, phant2WaitParam1Patch },
{ true, 4081, "replace spin loop after ratboy puzzle", 1, phant2RatboySignature, phant2RatboyPatch },
+ { true, 63001, "fix inventory left scroll delta", 1, phant2InvLeftDeltaSignature, phant2InvLeftDeltaPatch },
+ { true, 63001, "fix inventory right scroll delta", 1, phant2InvRightDeltaSignature, phant2InvRightDeltaPatch },
+ { true, 63001, "fix inventory wrong initial offset", 1, phant2InvOffsetSignature, phant2InvOffsetPatch },
{ true, 63004, "limit in-game audio volume", 1, phant2AudioVolumeSignature, phant2AudioVolumePatch },
{ true, 63016, "replace spin loop during music fades", 1, phant2Wait4FadeSignature, phant2Wait4FadePatch },
{ true, 63019, "replace spin loop during computer load", 1, phant2WaitParam1Signature, phant2WaitParam1Patch },
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index 687ecd64f3..a49690a703 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -1003,9 +1003,6 @@ CelObjView::CelObjView(const GuiResourceId viewId, const int16 loopNo, const int
_height = celHeader.getUint16SEAt(2);
assert(_width <= kCelScalerTableSize && _height <= kCelScalerTableSize);
_origin.x = _width / 2 - celHeader.getInt16SEAt(4);
- if (g_sci->_features->usesAlternateSelectors() && _mirrorX) {
- _origin.x = _width - _origin.x - 1;
- }
_origin.y = _height - celHeader.getInt16SEAt(6) - 1;
_skipColor = celHeader[8];
_compressionType = (CelCompressionType)celHeader[9];