This was a silly thing to have, and actually it was not
implemented correctly, as a cam or viewport with 0th index is not
necessarily the "primary" one (set as Game.Camera and
Screen.Viewport). The logic was rather weak there anyway.
From upstream eb90cfa46251d595f8b8f8c5f29ea720d2833038
Previously Overlay.SetText was passing into CreateTextOverlay() -> Overlay_CreateTextCore() -> _display_main().
This effectively removed and recreated an overlay with different image but the same ID.
Also, previously, this method could have been only called for custom overlays in practice.
For these the script object was not touched, and kept the correct overlay reference.
The situation has changed when we let user script to access some of the internally created
overlays, such as Text and Portrait overlays created by a blocking Say command.
When these overlays are recreated, they also must be completely destroyed, invalidating any
existing script references. Hence calling _display_main() from Overlay.SetText() is no longer
acceptable, as it leads to a full overlay recreation, and possible duplication of a script
reference with two (or more) separate managed handles (this is almost like, two shared
pointers owning same object).
To fix this problem, here we replace a call to CreateTextOverlay() with manual recreation of a
textual image, and assigning a new image to the same overlay.
This does not change anything from the script's POV, as SetText method already suggests
that the overlay reference remains valid (previously only the internal object was secretly
replaced).
From upstream aaf6144e5123d36e4f04fcc6592b02ec18f869e0
This simply makes generation of the textual image a separate function that may be used elsewhere, besides creating a new message overlay.
From upstream a49550d32e9ea210e2d9b6711157251359d3c4c0
Before playing a sound clip, check that the sample rate is acceptable for the sound system.
This avoids a crash to debugger in "The Excavation of Hob's
Barrow" which contains a sound effect that gets detected
at an incorrectly high sample rate.
Was broken by dec92f05ea9156961d17d9a7f62f11d73b8dba07
(e38df03c5d1658a2c44a26ba4ee6f22663c1e701 in upstream).
Some games do not have function arg count appended to the function names in
the export table; in that case `export_args` remained uninitialized.
From upstream cdbb7a7367db57e14983015232ecc97f6a3dd212
From upstream 6a238e9cb4acda222898dd4b597cf20581b401f6
This replaces a slightly different fix we had in ScummVM. But this new
code works better and fixes bug #12949
This argument works similarily to Viewport.ScreenToRoomPoint():
if it's set to true then the function returns null if there's no
viewport under the cursor; if it's set to false it converts
coordinates through the primary viewport in such case.
From upstream 5014c502aa487d3cbdf01e99d57306f2131d4c54
Some custom engines supported Label.TextAlignment before 3.5.0 got this
added officially, except they used old alignment constants.
From upstream 46fc9bac4fa6082561a1937861b3e567ccea2cd4
The code is present but not used in ScummVM. Keeping it synchronized
with upstream might help in the future.
From upstream fcf4b76914a25daaf5a7b711b7ed287e5eaae9f6
This is mostly a cosmetic fix, as graphic mode was created successfully anyway.
But the engine was incorrectly reporting no suitable modes available.
From upstream 4399d6448c579c648fe7e0c157a6d5f1adc74a6c