This fixes occasional problem with save overriding game options that
must not be changed at runtime.
From upstream cf093f3a6ea657a2082edfc08c35cc7650961ab6
This fixes a case when a clip was ordered to Play right before
a Room change, or similar game mode change, but is delayed
until after the change occurs.
From upstream d327b06bf5f3d8fff02b454d07560fcd5fc05b24
This fixes IsSpeechVoxAvailable() returning positive when game is run from
the Editor, because Speech folder is always created in the project.
From upstream 0ca660e998e69283484f74818e17e837889e5896
The bug is in UpdateSharedDDB(), the short-term texture cache did not test
whether the bitmap resolution is still matching the texture.
From upstream 1537ed77c875bbe660face3c07a3c4843b8bd95a
The bug is in UpdateSharedDDB(), the short-term texture cache did not
test whether the bitmap resolution is still matching the texture.
From upstream 1537ed77c875bbe660face3c07a3c4843b8bd95a
* handle readonly options;
* don't do anything if new value equals old value;
* replace if/else sequence with a switch;
From upstream 2476bc3e517c13ef1abde83fca2e55571bcfff4a
The latest change (c694126) was meant to fix a timeout test logic,
but it broke the primary loop count check.
The incorrect behavior may be observed when a function with
many loops and `noloopcheck` modifier is called *repeatedly*
from another function. Normally in such case the iterations
passed withing a `noloopcheck` function should not be counted,
but they were.
Apparently the situation cannot be resolved without having 2 counters:
1. One is working all the time, and is used to detect timeouts, as these
may occur both in normal circumstances and in functions with
`noloopcheck` modifier.
2. Second is working only in functions without `noloopcheck` modifier
and is used to do the "stuck in a loop" test.
+ backported small optimization from 3.6.1 branch.
From upstream 70afd47f4879b4eaed5dab664af9e4485055875f
changing voicepack
This is a tentative fix for bug #14459. Unfortunately I couldn't find other
games that change the speech pack "on the fly" for further testing
This is the only relevant part of upstream commit
a46b97fc3bf7fdff82b84a863a3c0cacc37e7a2b
"Engine: explicitly search for plugins in a game's data dir too"
(ScummVM does not support external plugins)
Before checking if an animation frame is not used (numFrames < 1),
make sure that the addressed frame is actually present in the loops vector.
Fixes#14491 affecting blackwell2, mountainsofmadness and possibly others
Games may attempt to create files in %appdata%, which is not supported.
Redirect to the saves directory, prepending the gameid.
This fixes an immediate crash in "Beat the Buzzer" and "There's Something in
the Pipes", which create .ini files using the iniFile2 module.
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
When the setting is changed in game (for example in the Options
dialog in Kathy Rain) that change used to be saved in the ScummVM
config file, but this got lost during one of the synchronisation
with upstream code. This commit adds that code back.
This complements the original idea, but also as a side-effect fixes a mistake introduced by another hotfix 38d0dd3.
Because the ID remained intact in the texture, the engine would not know to stop using it and replace after a dynamic sprite was deleted.
From upstream 87cc8e099169b82c2393282921e4d8295af4d0a9
* Fixed _lastAliveTs was not reset right after calling sys_evt_process_pending();
this caused events polling called continuously after timeout happened once.
* Set timeout to 60 fps (16.777 ms) instead of random 10ms.
* Do the timeout test only each 1000th loop iteration.
* Few other tiny adjustments in code.
Partially from upstream 60aaef003021fec2f75d4dc6db1b24f0b5d2be65
Historically, this function could *happen* to create bitmaps of
0x0 or even -1x-1 sizes and return a valid DynamicSprite
object. Try to ensure the image library is passed valid
parameters in such case, and keep going, for backwards compatibility.
From upstream 82194b261b4649281742c45498a4c34f452fd350
Firstly, this is not necessarily optimal, as the next graphic
assigned to these objects may be of same size, in which case
the texture surface may be reused.
But there's another thing: there've been a bogus behavior in
the AGS, where a dynamic sprite, deleted right before the
room's exit transition, was still displayed for room objects (and
everything else really).
This is because although the sprite was disposed, the image
remained on a texture connected to these objects, at least
until the next object update. But object updates don't run
during room transitions, hence the effect.
From upstream 38d0dd3d7f0d6a4624d1f908f2e8d3c1abfee52a
Because some things were previously updated during the
render, we also need to explicitly run these whenever we do
not update whole game, but need to keep cursor updated:
* Dialog options;
* blocking Display command
* built-in gui dialogs
From upstream e236f3ee05bb7e1e748fb050c99ba1afa564ec65
This is necessary for the touch-to-mouse emulation to work
properly (and perhaps true touch controls in the future).
The order of updates is a bit wrong historically, where cursor
position and gui control focus is updated later than the
handling of button events. This means, for example, that if the
cursor was positioned over button in game frame 1, then the
mouse click will only trigger button press not later than the frame 2.
Changes:
* moved "cursor over gui" poll from draw_gui_and_overlays()
to update_cursor_over_gui(), call it in the main game update fn.
* moved update_mouse_cursor() call from
construct_game_screen_overlay() to the game update fn
(renamed to update_cursor_view().
* picked out "cursor over location" trigger out of the "render"
function into update_cursor_over_location(), call it explicitly in
the main game update fn.
Effect on user script callbacks:
* the cursor position (and gui focus) will now be updated prior
to `late_repeatedly_execute_always()` callback. Other callbacks
will not be affected, as their relative order won't change
compared with these updates.
From upstream 23493a681d4f66ae0b1088cddb82241b0bc80dbb
This is a slightly "hacky" way to fix the queued sounds
starting with a small gap after the previous sound ends.
Because of the new audio playback subsystem in AGS 3.6.0,
the clip start timing changed a little, and there appear to be
small gap, about 1-2 game frame long, between previous and
next sound in queue. The queue in AGS is not implemented
ideally, because it relies on being updated once per game
frame, rather than on an audio thread etc, but this is
something we cannot change easily right now (maybe will
reimplement whole thing later).
This commit does 2 things:
1. Sync logical channels with the audio subsystem also *prior*
to updating queue and other things (crossfade etc). This fixes
a 1 game frame queue delay.
2. Additionally, force queued clips to start 1 extra game
frame earlier, by testing current playback position of active clips.
From upstream e87e3a8d862d39cd6eaab7a6245373fba84c4f78
Apparently, this field was used to store light level of the
walkable area in pre-2.55 engines, prior to introduction of the
Regions.
In current engine, when loading games that old, this value is
copied into Regions for backwards compatibility.
While in newer games it actually stores "player character
view" override.
Renamed update_shadow_areas() into update_player_view(),
and tidied the code for clarity.
From upstream 71e7dc880b4496dd6937cec00a56f0de66137482
This fixes internal mod key counter not being reset, which
may break service key combos (alt+ctrl, and so forth).
From upstream 142e1aaa11e7de2995ddfd24c3f1df0ae6c1b072
The base class will now take care of not applying vsync when
not necessary, saving the new state, and anything else generic.
SetVsyncImpl() virtual method will be overridden by each
renderer to provide actual implementation. This also allows
setting vsync to be forced internally.
Partially from upstream 81aa25ab6af683f52ebf5a5054f59824fa8851fc
The graphic mode config has now separate options for
window size, game scaling and filter, but command line is
lagging behind, so all the scaling is still set in `--gfxfilter`.
This is a hotfix for the time being, we shall think this over in
the future, maybe introduce more args.
Partially from upstream a28160b24a2f27b59cbb12a1de358cc9ec9c19ef and
f19043d902ff9a7e7d6478f51093ef3c807dd258
Screen limits are hardcoded in ScummVM's implementation, so this function
does not really validate anything
Partially from upstream cbe729f93c9b204db41ddd1b28c455d4a98ff703
This is because of legacy AnimateObject behavior, which treated IDs >= 100
as a command to run AnimateCharacter(ID - 100) instead.
From upstream 8365802092cd3f704aecffe7d08b4d9f65f1f396
Also restored a check in System_SetVolume(), where it skipped updating a volume if the value
is the same (this was removed unexpectedly when introducing a SDL2-based audio system).
From upstream 8d1772b90105ca5b4b150bfb303781af2ceac1a0
This is a (ugly) backward compatible workaround in game_sprite_deleted().
Apparently there are few games that may rely (either with or without author's intent) on newly
created dynamic sprite being assigned same index as a recently deleted one, which results in
new sprite "secretly" taking place of an old one on the GUI, etc.
One known example is "Kathy Rain" game.
For old games we keep only partial index reset (full cleanup is 3.5.0+).
From upstream e8409920049b2a8859856d3525a8f112227df4df
Assume that SDL2 devices, custom devices, and event handling unit have prepared a correct absolute mouse coordinates, in correspondence to the mouse settings.
From upstream c63e5e93657f2e525df8f3f5390f74a31a21858d
Apparently, this is an ancient bug, but it became noticeable
now after some changes to the GUI update logic fixes and
optimizations.
From upstream e069c3f51c08c163df023157e99e14bbcefd317a
The original AGS uses a proportional stretch that preserves the
video aspect ratio, but we were doing a stretch to the full game
screen. As a result if the video and game do not have the same
aspect ratio we were losing the video aspect ratio. This could
for example be seen with the AGDI logo at the start of all the
AGDI games. The games re at 320x200, but the video are 320x160.
Before this commit the video was stretched incorrectly to
320x200.
From upstream b3f4909.
Fixes a regression from d2b0380 (86564e9 in upstream) where the extra
channel allowance was added excessively for all cases.
Fixes bug #14353 (crash in unavowed).
ags64 (and also ags32) are the name of the engine executable on Linux.
These names seems to be exclusivelly used for that OS.
Fix a bug in Zniw Adventure (GOG, Linux) due to translation path being
different between Linux and Windows.
NOTE: the code theoretically allows any object to be sorted this
way, but the problem is, the ID sequences are not shared, and
multiple object types may have same IDs.
This is something to consider in the future.
This allows to properly fixup (upgrade) RoomStatus structs
restored from a older format save in an upgraded game.
For example: game was upgraded from 3.4.0 to 3.6.0, but player
tries loading 3.4.0 save. In this situation the engine must know and
keep track of what version each RoomStatus was saved in.
This is necessary, because RoomStatus can only be updated upon
loading a corresponding room file (when entering a room). This
means that multiple RoomStatus objects will be staying in memory
not being upgraded yet, until player enters particular room.
From upstream 205232af5909e0a257494ff404f36003b004ebc4
When plugin calls SetVirtualScreen (for software renderer), don't
replace whole virtual screen, instead replace only the current
render stage buffer.
This is complementary to the older changes in software renderer,
made during development of AGS 3.5.0, which featured advanced
room viewports and cameras. Since that change, separate render
stages could draw on sub-bitmaps of smaller size.
While IAGSEngine::GetVirtualScreen() was adjusted to follow that
change, and return not the whole virtual screen, but only a "stage
buffer" (which may be a VS sub-bitmap, or an intermediate bitmap
created specifically for this render stage), SetVirtualScreen() was
NOT adjusted accordingly and kept replacing whole VS. As a
result, this discrepancy could cause logical errors, as well as
crashes with plugins that use this API (e.g. original SnowRain
plugin).
The immediate reason of error is that plugin would remember a
pointer returned from GetVirtualScreen (which is a stage buffer),
and then try to set it back with SetVirtualScreen. As a result,
engine's own stage buffer is assigned as a full virtual screen.
From upstream 09143ea7fbf8474f78932116ae1c81ceff4de95a
In ALSoftwareGraphicsDriver:
* Save index of a currently rendered sprite batch (or none, if not inside
a render pass).
* In SetMemoryBackBuffer() don't reset virtual screen subbitmaps
unless we are outside render pass.
* In InitSpriteBatch() also test if batch's surface is subbitmap to the
current virtual screen (in case one was replaced, but batch's surface
stayed).
Partially from upstream 5dd078961020da6478347dac01dea729471333d1
This is primarily for backwards compatibility with the older plugins,
that relied only on software drawing.
Previously we added "stage screens" to the hardware-accelerated
graphic drivers (Direct3D/OpenGL), which provide a surface for
plugins to draw upon. If used, these surfaces would then be rendered
as plain sprites in 3D scene at certain place in the sprite sequence.
The remaining problem (left unnoticed) was that the surfaces which
correspond to the two room render callbacks (right after background,
and right after all objects) did not follow the room camera position and
scaling correctly (not all, tbh). This commit addresses these problems by
letting the engine to request certain size and optional position for these
"stage screens" for particular sprite batches.
Partially from upstream 2d43bffc2cb07935ae72d7c5677ad622c8b4d37e
This significantly reduces memory usage, as screens will be only
created for sprite batches, during which the plugin requested
memory backbuffer for drawing.
Partially from upstream 1b71780d6e94eca33ee3234fd138213874640ab1
This may be a temporary solution, but it's necessary, because otherwise
engine will fail later, with a seemingly unrelated error, which will
be harder to diagnose.
From upstream 902568c4eba9dba4eb762882890c6e8a308683aa
The example when this could happen:
Parser.Said("climb,get in bed");
where "climb", "get" and "bed" are dictionary words.
From upstream b633ca77076137e2402faa903f5b6fbcd3f4c3bc
I'm baffled how I did not notice this behavior earlier, but engine was
created at least 2 redundant intermediate bitmaps meant to cache
transformed sprites per each object and character on screen for
HW-accelerated renderers, - which they do not need, as they don't
use software transformations.
The resulting effect won't be too notable for low-res games with low
amount of simultaneous objects, but may be quite significant for the
high-res games with multiple large objects in the room.
From upstream cca997fe83ec5f7014677a69095a7c9ec1494cd9
Leave it with a new name as `update_polled_stuff()` only in functions
related to the game update.
From upstream 95dc139f51e704da19792e5480e69bbfe7ec27aa
Completes commit 8e77b04062d865e35bbadedce2fb7ba4971b837c.
We don't support subdirs in saves, the previous change causes some
games to be unable to save/restore