Commit Graph

1245 Commits

Author SHA1 Message Date
Walter Agazzi
150df392b4 AGS: Engine: fixed <3.6.0 Animate functions default volume parameter
From upstream d8d94b36a3e4e7fe201e93965952698fc6c8da5e
2023-04-29 14:32:39 +02:00
Walter Agazzi
2deb622aa9 AGS: Engine: fixed FadeIn/Out and ShakeScreen prevent audio from starting
From upstream 9634b6d3613f2b066998eaaf853945017f59fa01
2023-04-29 13:11:41 +02:00
Walter Agazzi
7ca114ea49 AGS: Engine: made FadeIn and FadeOut functions look consistent
From upstream 95c4362271734c5cb724b314d7cc555f752e06a8
2023-04-29 13:11:41 +02:00
Walter Agazzi
ea65074e6b AGS: Engine: expanded a compat comment in find_free_audio_channel()
From upstream 4392ef832f131c8fd1e5ded00b095f78cf4815ca
2023-04-29 13:11:41 +02:00
Walter Agazzi
37f97cc8b6 AGS: Engine: add bitness and endianess to the printed engine version
+ Use term "engine" instead of "ACI" (a legacy "Adventure
Creator Interpreter" title).
From upstream eaf298ae3f96db6e37bfd9ac99bad1dff48430ae
2023-04-29 13:11:41 +02:00
Walter Agazzi
f9de999bbe AGS: Engine: Update cursor and dependent "logic" in special game states
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
72888a7a8c AGS: Engine: move cursor and cursor-over-gui updates to the game update fn
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
7808fb52e6 AGS: Engine: tidied few remaining old functions in Mouse namespace
* minstalled -> Mouse::GetButtonCount();
* msetgraphpos -> Mouse::SetSysPosition() (internal);
* mgetgraphpos -> Mouse::Poll();
* msetcursorlimit -> merged with Mouse::SetMoveLimit();
* msethotspot -> Mouse::SetHotspot().

From upstream 9211b07f36528776e6fabc34a29405b6d63f6c23
2023-04-29 13:11:41 +02:00
Walter Agazzi
dedc6e009d AGS: Engine: a fix for the queued sounds (PlayQueue) starting with a gap
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
c537416279 AGS: Engine: renamed WalkArea.Light to PlayerView, matching its real purpose
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
2db380f1d1 AGS: Engine: save vsync property when the result is known
From upstream 178a25b4384c3c96998fc6750a3bc0b4ebda3e5d
2023-04-29 13:11:41 +02:00
Walter Agazzi
863a3c485a AGS: Engine: push SDL_KEYUP when simulating a keypress
This fixes internal mod key counter not being reset, which
may break service key combos (alt+ctrl, and so forth).
From upstream 142e1aaa11e7de2995ddfd24c3f1df0ae6c1b072
2023-04-29 13:11:41 +02:00
Walter Agazzi
334e34407b AGS: Engine: try to remember when vsync is unsupported / failed
Partially from upstream 5a867c211abf3e288259e8103b2f948eb354aac4
2023-04-29 13:11:41 +02:00
Walter Agazzi
92f0189a0e AGS: Engine: for renderers, picked out SetVsync into base, add SetVsyncImpl
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
430758510e AGS: Engine: center the SDL window ourselves on desktop platforms
This is not implemented and just add a  stub
Partially from upstream 82b19ca27b682c497422ad8eac532ceb88c67e62
2023-04-29 13:11:41 +02:00
Walter Agazzi
a80928712d AGS: Engine: restored --gfxfilter support for explicit scaling multipliers
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
7d7a6c6b4e AGS: Engine: improvements to ValidateWindowSize()
Screen limits are hardcoded in ScummVM's implementation, so this function
does not really validate anything
Partially from upstream cbe729f93c9b204db41ddd1b28c455d4a98ff703
2023-04-29 13:11:41 +02:00
Walter Agazzi
7b3ca8febf AGS: Engine: simplify PlayMP3File asset loading
From upstream 3653e184243e0eb6b559726c6b33b1e55f52d1f4
2023-04-29 13:11:41 +02:00
Walter Agazzi
7133cbfcdb AGS: Engine: fixed room objects with ID >= 100 fail to Animate
This is because of legacy AnimateObject behavior, which treated IDs >= 100
as a command to run AnimateCharacter(ID - 100) instead.

From upstream 8365802092cd3f704aecffe7d08b4d9f65f1f396
2023-04-29 13:11:41 +02:00
Walter Agazzi
a6335f0a8b AGS: Engine: bit more logging when loading a translation
From upstream 528c1374cee8d8e09654dc5d01698984dd29568a
2023-04-29 13:11:41 +02:00
Walter Agazzi
7676b9c23b AGS: Engine: hotfix master volume is not applied after restoring a game
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
2775d0e3d0 AGS: Engine: a fix for coincidental dynamic sprite replacement in old games
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
0cc9cb6d22 AGS: Engine: always rely on absolute mouse coordinates in mgetgraphpos()
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
c23db8fa2c AGS: Engine: removed redundant code from mgetgraphpos()
From upstream 07d72ac3e1c89883c9e9430a22596ac19c3c58b1
2023-04-29 13:11:41 +02:00
Walter Agazzi
6565ca8530 AGS: Engine: allow VSync in windowed mode
From upstream bcf90697ac93080d0edac3e99727041a4e2b461a
2023-04-29 13:11:41 +02:00
Walter Agazzi
6a463caba0 AGS: Add _gamma and RenderTarget variables (not used yet)
These are the only relevant changes from upstream:
62b2f42b53010f9db17a89365d4db73eeb5056d7 and
33a2417f2d63638e87e9a6199b571a7929664722
2023-04-29 13:11:41 +02:00
Walter Agazzi
0a7fba00a5 AGS: Properly implement sprite batches for legacy modes
This completes commit c06dc7dab97ba33d9fcf2edeffe37e8f36e0336a which was only
partial and completely broke the mouse pointer and UI in old games
2023-04-29 13:11:41 +02:00
Walter Agazzi
b554ab3bad AGS: Engine: fixed non-blocking speech disabling interface
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
2023-04-29 13:11:41 +02:00
Walter Agazzi
9a801a02fd AGS: Engine: fixed preload image does not have a sprite batch
From upstream 84730a4bbfb971855c667241a9a47745f283f12e
2023-04-29 13:11:41 +02:00
Walter Agazzi
e402e69539 AGS: Engine: safety hotfix for render pass without sprite batches
Partially from upstream 7ad4f424f473f480c830faf3f7a2aca4388aa8fe
2023-04-29 13:11:41 +02:00
Walter Agazzi
d025390cfc AGS: Engine: safety hotfix for sprites met before 1st sprite batch
Partially from upstream 8e38f612d8b8fe834bdc8a55bb5ef543e6b45cb8
2023-04-29 13:11:41 +02:00
Walter Agazzi
30214dfb04 AGS: D3D/OGL: safety hotfix which deals with occasional "stray" sprites
Partially from upstream ae559b469fc5dc4b01d3497f5ca13c2961c98c82
2023-04-29 13:11:41 +02:00
Walter Agazzi
a099b5c976 AGS: Engine: define no batch parent as -1, and don't pre-init any batches
Partially from upstream 975e2192bce136d81275c93310d3de200de1bfba
2023-04-29 13:11:41 +02:00
Walter Agazzi
6dcabde06a AGS: Engine: for software drawing, also split room viewport / camera batches
From upstream 5446f80a4c95d4581991a52ea54781820f28244f
2023-04-29 13:11:41 +02:00
Walter Agazzi
3fec7f3d4a AGS: Engine: Software renderer supports parent-child sprite batches
From upstream f4f715f26c83be708da9c7dbfdcb0fa3196624b4
2023-04-29 13:11:41 +02:00
Walter Agazzi
976c757020 AGS: Engine: simplify sprite batches a little
From upstream 362ea919e9ffaf2407299fbf4e7815bc43ceac4c
2023-04-29 13:11:41 +02:00
Walter Agazzi
8ad4d50e07 AGS: Engine: base sprite batches use full global offset (inc main viewport)
This fixes legacy letterbox for Direct3D/OpenGL renderers.
Partially from upstream 29b62232b9c595cc05b5c6872e97544c1204f2b0
2023-04-29 13:11:41 +02:00
Walter Agazzi
a2e62d8391 AGS: Engine: simplified main viewport storage, from Viewport struct to Rect
Can't remember why did I make it so, the Rect is enough for now.
From upstream f7a408d6cea65a5279f3b5b4e980c87bc1e381ca
2023-04-29 13:11:41 +02:00
Walter Agazzi
74f58fd118 AGS: Engine: small fix in SDLRendererGraphicsDriver::RenderToBackBuffer()
From upstream dc22dfcd09f5e29aae8fefbbfe3c6cb0aca97937
2023-04-29 13:11:41 +02:00
Thierry Crozat
fd2bc62037 AGS: Fix crash when playing CLUT8 video in 16bit or 32bit games
The blitting code asserted on the palette pointer as it was not
passed to it.
2023-04-25 21:44:51 +01:00
Thierry Crozat
85b832d02e AGS: Fix wrong color when playing CLUT8 video in CLUT8 games
The palette from the video decoder was ignored, and it was using the
palette from the game instead.
2023-04-25 21:44:51 +01:00
Thierry Crozat
6e05d981b0 AGS: Fix video stretch
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.
2023-04-14 01:16:05 +01:00
Thierry Crozat
2808192828 AGS: fixed find_free_audio_channel() incorrect compat fix
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).
2023-03-29 22:02:38 +01:00
Thierry Crozat
42838612d2 AGS: Fix double-free of room cameras surfaces
This fixes a crash in Dreams in a Witch House (bug #14338)
2023-03-27 01:01:55 +01:00
antoniou79
10a5566dab AGS: Fix formatting of debug message
About bad index of audio channel
2023-03-23 13:53:04 +02:00
marius david
9acaed1f89 AGS: auto-detect Linux games based on executable
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.
2023-03-20 00:17:20 +01:00
D G Turner
be309e97eb AGS: Fix GCC Compiler Warnings 2023-03-12 20:58:29 +00:00
Walter Agazzi
07bbbcd233 AGS: Engine: replaced couple more shared_ptr<char> with vector<char>
From upstream 1cccdfea5c1009123de7ba25be72b2757f74d06f
2023-03-12 20:58:28 +00:00
Walter Agazzi
9a4817653c AGS: Engine: resizable flag is necessary for fullscreen app rotation
From upstream 51a7e64efd628e62c73b1b1b8011d22ec83b0c38
2023-03-12 20:58:28 +00:00
Walter Agazzi
15d43b09ad AGS: Common: add AGS_PLATFORM_MOBILE for Android and iOS
Partially from upstream 4404881c6a49e3a74f316998ee46368b00895fc7
2023-03-12 20:58:28 +00:00
Walter Agazzi
9743b0dd6c AGS: Engine: restored GUI draw sort, where equal z is resolved with IDs
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.
2023-03-12 20:58:28 +00:00
Walter Agazzi
9a469f1e2b AGS: Engine: support fixing up RoomStatuses restored from older save formats
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
2daaef2d48 AGS: Engine: updated SavegameVersion (had few cmp changes since last one)
From upstream 84417e8c73815bcd35f4a6812d6f118cfb3acacb
2023-03-12 20:58:28 +00:00
Walter Agazzi
89ea094df1 AGS: Engine: fixed idle_anim_speed after restoring old save in updated game
From upstream 0f19fc3d2b9efbc4eb809032bcb7d60b652e1150
2023-03-12 20:58:28 +00:00
Walter Agazzi
3d91a8835e AGS: Engine: fixed button keeps "mouse over" pic after Visible = false
From upstream dcec61ba9825be21a0d2009a73b2af24df6a912d
2023-03-12 20:58:28 +00:00
Walter Agazzi
50d8eaddcf AGS: Engine: in IAGSEngine::SetVirtualScreen set Stage buffer, not whole VS
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
43723e170a AGS: Engine: in SetMemoryBackBuffer() don't reset batch surfs during render
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
e62a2c3504 AGS: Engine: don't reset batch surfaces in software driver's ResetAllBatches
From upstream 662318d0dc1e877a334e91b1a964a41de2b46573
2023-03-12 20:58:28 +00:00
Walter Agazzi
1bc1c49dbf AGS: Engine: fixed missing channels after restoring old save in updated game
From upstream d5ded80f8219b1f04e484c369d647bbc9ed8edd8
2023-03-12 20:58:28 +00:00
Walter Agazzi
f0c18ccacb AGS: Engine: fixed GUI sorting for cases when ZOrder is equal
Was broken by fcc873e
From upstream ff210b2ce50cea0e903cd1d09fa7ad1734a862b0
2023-03-12 20:58:28 +00:00
Walter Agazzi
7b5bcb881a AGS: Engine: fail when reading game data should return error
From upstream 416c456db0b20f5896506f86525faec0a353893f
2023-03-12 20:58:28 +00:00
Walter Agazzi
88a1083e0d AGS: Move strlen out of loops
From upstream b476dfca4b40bc2ca59b7f0fd793543524397ccf
2023-03-12 20:58:28 +00:00
Walter Agazzi
c6864a8a67 AGS: Engine: added _rendSpriteBatch counter to software renderer
From upstream 5d051d614cafe2a4f73cc4399eeb78cb38d8ed2d
2023-03-12 20:58:28 +00:00
Walter Agazzi
1e3bb9c241 AGS: Engine: support optional size and position for gfxdriver's stage screen
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
823eda7991 AGS: Engine: renamed "NullSpriteCallback", give more meaningful name
From upstream e3c6f5f0b607b8d3a747fa56bdac723ff833f482
2023-03-12 20:58:28 +00:00
Walter Agazzi
6343759e09 AGS: Engine: changed member names in StageScreen to avoid conflicts
From upstream 874953aea46a23f2ea49ee571cbce28fdc701f25
2023-03-12 20:58:28 +00:00
Walter Agazzi
982abc24f3 AGS: Engine: create raw draw screens only on plugin's demand
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
711ca20dd1 AGS: Engine: abort in case failed both to switch and restore gfx mode
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
f0887a3b9f AGS: Engine: in gfx drivers record sprite range for each batch
Partially from upstream eaa806927bf4608195fe58de405750836093032c
2023-03-12 20:58:28 +00:00
Walter Agazzi
b828199c25 AGS: Engine: renderers support creating DDB as a render target
Partially from upstream 4c8218e9ca4da7403ff14e45c57584517d2abc2f
2023-03-12 20:58:28 +00:00
Walter Agazzi
48592b9eee AGS: Engine: add screen functions to plugin exports
Reimplemented from upstream 5497c87cc1443d155bd89a76dddf91934b7e0bb5
2023-03-12 20:58:28 +00:00
Walter Agazzi
5a2405d291 AGS: Engine: debug use AppendFmt at send msg and clang-tidy fixes
From upstream 96f0b3d5e216fbba6df3cb47df3d28687b4dd5e4
2023-03-12 20:58:28 +00:00
Walter Agazzi
97d08215b5 AGS: Engine: Use a single function to send messages to editor debugger
From upstream 003243d6c925d176d6e206bed7c1c930952ba2da
2023-03-12 20:58:28 +00:00
Walter Agazzi
7e3ffd0161 AGS: Engine: unswitch loop in Bitmap to Video memory
bmp to video don't test depth per pixel
From upstream 85344c94e2367fe3bb8eb3b9249329c1d1b49f24
2023-03-12 20:58:28 +00:00
Walter Agazzi
b7080efc96 AGS: Engine: for hw renderers split viewport and camera in 2 sprite batches
Partially from upstream 5d6c075013a0c83fb2ad5b58f0313e5e2eb4f728
2023-03-12 20:58:28 +00:00
Walter Agazzi
2359c13d23 AGS: Engine: moved global sprite offset & flip to the parent batch transform
Partially from upstream 76a2a22ebfd5a8513337a64d6d4e857295ee38bc
2023-03-12 20:58:28 +00:00
Walter Agazzi
2b028c586f AGS: Engine: hotfixed BitmapToVideoMem after 6804e9f
From upstream 0b3d4dc8b72cce99920bea44094a8c7a3e423f49
2023-03-12 20:58:28 +00:00
Walter Agazzi
bfc5f63026 AGS :Engine: draw fix, true means texture don't change
From upstream d5958eab884c079c00845c35e46ef0302152ded5
2023-03-12 20:58:28 +00:00
Walter Agazzi
0f86678e2d AGS: Engine: only clear _stageScreen after it's dirty
From upstream d60022c715f15d0454ffe04d4ce8d331c34e3045
2023-03-12 20:58:28 +00:00
Walter Agazzi
afed888bb5 AGS: Engine: avoid dirty rects outside software render surface
From upstream c4dce7eb4a0ab4d2440a8b7e637ea8a7f9ed2c00
2023-03-12 20:58:28 +00:00
Walter Agazzi
818b670561 AGS: Engine: fixed text parser could substring with negative length
The example when this could happen:
    Parser.Said("climb,get in bed");
where "climb", "get" and "bed" are dictionary words.

From upstream b633ca77076137e2402faa903f5b6fbcd3f4c3bc
2023-03-12 20:58:28 +00:00
Walter Agazzi
3d4856d321 AGS: Engine: for HW renderers - don't create redundant object cache images
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
2023-03-12 20:58:28 +00:00
Walter Agazzi
2cffebe3a5 AGS: Engine: use unique_ptr to store raw image in ObjectCache
From upstream a06d97dc88887395f3f961ab8e3fbda277733795
2023-03-12 20:58:28 +00:00
Walter Agazzi
f58c4d9bdb AGS: Common: replaced couple of smart ptr arrays with std::vector
From upstream c1afae64fe348c64ee4a8c8888349ae267241395
2023-03-12 20:58:28 +00:00
Walter Agazzi
26375b823b AGS: Engine: Used std::vector for RoomStatus::tsdata
From upstream 849a0f3153511087bd93c4d7d1ba898d4ab28cfa
2023-03-12 20:58:28 +00:00
Walter Agazzi
88f0170696 AGS: Engine: Fixed RoomStatus::tsdata allocation of additional bytes
From upstream 894ec8a85bd2c78438c8bfabee632b26f5323b07
2023-03-12 20:58:28 +00:00
Walter Agazzi
e0d2bc8860 AGS: Engine: Fix malloc/delete mismatch with RoomStatus::tsdata
From upstream cf31083808f19ae314212e7b451709cfd5d6f05d
2023-03-12 20:58:28 +00:00
Walter Agazzi
91d7299405 AGS: Engine: (again) fixed buttons not updated visually on interface enable
Complements / reimplements f310a08
From upstream b0e2fe40c1d73674a7b868a87152be6029df6cac
2023-03-12 20:58:28 +00:00
Walter Agazzi
ecc1d17655 AGS: Engine: register missing SetProperty script functions for plugins
Reimplemented from upstream 96d52b258dd226bc8c2243c1a5bc95a9ceeecd2a
2023-03-12 20:58:28 +00:00
Walter Agazzi
0fbdbdfcdd AGS: Engine: fixed WaitInput() incorrect handling of a type arg
From upstream ca6620951ec013e3627d962701c3cc25c1ac8adb
2023-03-12 20:58:28 +00:00
Walter Agazzi
49e61b6ea2 AGS: Engine: let use dummy frame 0 if the speech view's loop is empty
This complements / fixes previous fix attempt 08aef03
From upstream 95c99fc325f8550f220e7a0f67d6555bb23c8c5a
2023-03-12 20:58:28 +00:00
Walter Agazzi
f77da38379 AGS: Engine: fixed view frames have a linked sound 0 by default
from upstream a4a98adfcb039e0f8f213d60e8b0b639b0217f9b
2023-03-12 20:58:28 +00:00
Walter Agazzi
c366ce5eef AGS: Removed update_polled_stuff_if_runtime() from data loading functions
Leave it with a new name as `update_polled_stuff()` only in functions
related to the game update.
From upstream 95dc139f51e704da19792e5480e69bbfe7ec27aa
2023-03-12 20:58:28 +00:00
Walter Agazzi
e7e7e4a446 AGS: Engine: keep mouse speed control enabled (by default, fullscreen only)
Partially from upstream 1f867858c46c8a2dde841022aed8631f1deeabb1
2023-03-12 20:58:27 +00:00
Walter Agazzi
3ddbd08585 AGS: Engine: in render_to_screen() do at least 1 delay in case of DEVICELOST
from upstream 27306da4cd0c1fa193f984644aa1915c8a944364
2023-03-12 20:58:27 +00:00
Walter Agazzi
d372745e35 AGS: Prevent savepath manipulation in ScummVM
Completes commit 8e77b04062d865e35bbadedce2fb7ba4971b837c.
We don't support subdirs in saves, the previous change causes some
games to be unable to save/restore
2023-03-12 20:58:27 +00:00
Walter Agazzi
61c7c0fcfe AGS: Engine: fixed gui controls not updated after interface is un-disabled
from upstream 126a5e4c97581aabadbbd4410441b83f371e18ea
2023-03-12 20:58:27 +00:00
Walter Agazzi
72592cc9e0 AGS: Engine: fixed ResolveScriptPath not handling subdirs correctly
from upstream 8d0e0cb3c20db0beddffc36c688ed33005a43d7c
2023-03-12 20:58:27 +00:00
Walter Agazzi
5ad85c6b42 AGS: Common: replaced GameSetupStruct::messages with an array of Strings
This also fixes an allocation/deallocation mismatch found in the code.
From upstream b47a086cbd589cd271c5fe1b3497f9b8e4ae4abf
2023-03-12 20:58:27 +00:00
Walter Agazzi
0263572d1c AGS: Common: fix mismatched free
uses new char[] on Create method.
From upstream ecfc238401183e210a1773c27724516f74272c8e
2023-03-12 20:58:27 +00:00
Walter Agazzi
8c6243052d AGS: Engine: in BitmapToVideoMem replaced if/else with a switch
This supposedly should slightly improve bitmap to texture conversion performance.
From upstream ab213c0962df7bdec96ce38122f637f0febe4ef4
2023-03-12 20:58:27 +00:00
Walter Agazzi
2e9819ad4e AGS: Fix some overzealous renames
_GP(game) -> game
2023-02-24 21:13:17 +01:00
Walter Agazzi
45d7978b61 AGS: Check sound stream isn't null before playing 2023-02-04 11:57:12 +01:00
Le Philousophe
f17604cef5 AGS: Don't set VSync when it's not needed 2023-01-21 16:28:40 +01:00
Walter Agazzi
76579deff2 AGS: Remove unused OSX right mouseclick hack
Partially from upstream 3fd5531f79044f58c261d9af0c7401ab1edf4ca7
2023-01-20 17:25:14 +01:00
Walter Agazzi
da147138d4 AGS: Script API: removed a rule that Viewport and Camera 0 can't be deleted
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
2023-01-20 14:14:56 +00:00
Walter Agazzi
300379a2d6 AGS: Engine: ScreenOverlay.SetImage() accepts offset as arguments
+ Fixed overlays losing offsets when restoring a save.

From upstream 2002caf32882ab28accd544369c9991675a0dcb1
2023-01-20 14:14:56 +00:00
Walter Agazzi
7e3c3f1f0b AGS: Engine: reimplemented Overlay.SetText without call to _display_main()
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
2023-01-20 14:14:56 +00:00
Walter Agazzi
51e541cfb6 AGS: Remove unneeded La Croix Pan workaround
The help text now behaves like the original game
2023-01-20 14:14:56 +00:00
Walter Agazzi
862759135e AGS: Engine: split out create_textual_image() out of _display_main()
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
2023-01-20 14:14:56 +00:00
Walter Agazzi
6f82ba6008 AGS: Engine: fixed ScriptOverlay loosing ID when changing text
From upstream acd7ac23d35aafbceb0115b3c3ae1a946e4de20a
2023-01-20 14:14:56 +00:00
Walter Agazzi
dcba4db6f1 AGS: Engine: fixed voice is disabled if tried to enable already enabled vox
From upstream 24eb9c8f16cfc518ae343f825d49f05cefaee32e
2023-01-20 14:14:56 +00:00
Walter Agazzi
5614bc15de AGS: Engine: prevent cursor from leaving game area
From upstream 8cf49996d05a6fb4fd8691fa87fb6a12114e45d7
2023-01-20 14:14:56 +00:00
Walter Agazzi
2ef1dfd3a6 AGS: Engine: fixed few typos in error messages
From upstream dd961852cf3e94c202dd0d9a7984f90e48ccd2fa
2023-01-20 14:14:56 +00:00
Walter Agazzi
c683fef66e AGS: Add workaround for Dustbowl character creation
Avoid using the stubbed Steam GetUserName method to
initialize the character name
2023-01-19 20:39:37 +01:00
Walter Agazzi
2f817634af AGS: Check sound sample rate before playing
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.
2023-01-19 16:58:23 +01:00
Walter Agazzi
50a655871f AGS: Engine: fixed dialog parser not drawn on the correct position
From upstream 394866b2928433475fcfd0a3ab298e2b70570cbc
2023-01-17 17:27:07 +00:00
Walter Agazzi
028567e890 AGS: Engine: improved parameter logging in SetAudioTypeVolume
from upstream 94598f32ff20494a3239f258ac972f8108bc05bf
2023-01-17 17:27:07 +00:00
Walter Agazzi
902b92341d AGS: Engine: prevent invalid parameter in video player
partially from upstream 4efaf8116a2bd0bcf909b174dc28b945e4b52745
2023-01-17 17:27:07 +00:00
Walter Agazzi
43bdb0d5c5 AGS: Script API: Mouse.AutoLock
From upstream f49501a18b48767184e5f3d5da355405e29ad9e
2023-01-17 17:27:07 +00:00
Cameron Cawley
138a983d80 COMMON: Refactor VSync handling to match the other options 2023-01-16 18:09:53 +01:00
Walter Agazzi
de34fdbe68 AGS: Fix mousepress not being tracked
This caused the "autoclick/skipping lines" bugs
2023-01-03 14:31:27 +00:00
D G Turner
d5277a95c0 AGS: Fix Enumerated Type Comparison Mismatch GCC Compiler Warning
This is emitted when -Wenum-compare is passed to GCC.
2022-12-19 00:07:37 +00:00
Donovan Watteau
2c804b9c71 AGS: Fix AmigaOS and NDS builds 2022-12-18 14:03:39 +01:00
Thierry Crozat
1d4d6d501e AGS: Engine: corrected some of the key evt queue exceeding loops
Part of upstream 66738a0c4550ec349dcf45ec39030b56332e1ea8
2022-12-17 22:10:55 +01:00
Thierry Crozat
ccbe6f5419 AGS: Engine: in video_check_user_input() exceed all the keypress buffer
From upstream f7b90bbaaa242e4dc79d26fdddaf7e269e7ce600 and part of
upstream 66738a0c4550ec349dcf45ec39030b56332e1ea8
2022-12-17 22:10:55 +01:00
Thierry Crozat
b052270504 AGS: Engine: in built-in dialogs exceed all the keypress buffer at once
From upstream ec194e7fbd964f29e590d3b446db9dd3804e9e02
2022-12-17 22:10:55 +01:00
Thierry Crozat
57266951a9 AGS: Engine: fixed built-in textboxes not responding to printed chars
From upstream f1064e91c3b71e2bed4d866bb57b2d32fc1fed25
2022-12-17 22:10:55 +01:00
Thierry Crozat
3286cf18ec AGS: Engine: in display_main exceed all the keypress buffer
From upstream d2100b01ee4a85219b481dcd7593f0e0d419523e
2022-12-17 22:10:55 +01:00
Thierry Crozat
871d4b54e1 AGS: Engine: in DialogOptions exceed all the keypress buffer
From upstream 5488f02bae108c1f191a5b6ca3a46eee6497058a
2022-12-17 22:10:55 +01:00
Thierry Crozat
c156608796 AGS: Engine: fixed dangerous use of String::Wrapper in logging
From upstream 588d91ab6a09877eab06bf66073239db0d28271b
2022-12-17 22:10:55 +01:00
Thierry Crozat
5772893340 AGS: Engine: fixed CallScriptFunction for the ancient games + added comments
Was broken by dec92f05ea
(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
2022-12-17 22:10:55 +01:00
Thierry Crozat
6c18c2d5b5 AGS: Engine: support Clifftop Games custom engine's resolution mod
From upstream 6a238e9cb4acda222898dd4b597cf20581b401f6

This replaces a slightly different fix we had in ScummVM. But this new
code works better and fixes bug #12949
2022-12-15 22:40:17 +01:00
Thierry Crozat
3dee5bb762 AGS: Script API: add "restrictToViewport" arg to Screen.ScreenToRoomPoint()
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
2022-12-15 22:40:17 +01:00
Thierry Crozat
9a3ff9b285 AGS: Implement shake screen and flip screen support
This is partially based on upstream 675560f7c2060528ba7c75d5ecca78c56b9f0d8e
2022-12-15 22:40:17 +01:00
Thierry Crozat
54e99b36e9 AGS: Engine: support pre-3.5.0 Label.TextAlignment with legacy values
Some custom engines supported Label.TextAlignment before 3.5.0 got this
added officially, except they used old alignment constants.

From upstream 46fc9bac4fa6082561a1937861b3e567ccea2cd4
2022-12-15 22:40:17 +01:00
Thierry Crozat
7d88a52275 AGS: Engine: fixed restoring a legacy savegame
From upstream 9776df3c8403f252e981f5518c48eace2e83d373
2022-12-15 22:40:17 +01:00
Thierry Crozat
39c98f652c AGS: Engine: initialize SDL audio using env variables, don't SDL_AudioInit
The code is present but not used in ScummVM. Keeping it synchronized
with upstream might help in the future.

From upstream fcf4b76914a25daaf5a7b711b7ed287e5eaae9f6
2022-12-15 22:40:17 +01:00
Thierry Crozat
75a67377d6 AGS: Script API: added File.WriteRawInt(), complementing ReadRawInt
From upstream cf23239bcce2e50377866090a11f1489602fdd65
2022-12-15 22:40:17 +01:00
Thierry Crozat
887f156f73 AGS: Engine: OpenGL, Software drivers also try 24bit display modes for 32bit
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
2022-12-15 22:40:17 +01:00
Hubert Maier
1d8c47257a JANITORIAL: AGS: Correct Spelling Mistake
alot -> a lot
2022-11-15 22:52:43 +02:00
Hubert Maier
472c51b27c
AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:08 +02:00
Hubert Maier
f1c3261837
AGS: Correct spelling mistake
lightening -> lightning
2022-10-27 15:56:08 +02:00
Hubert Maier
912adcf19b
AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:08 +02:00
Hubert Maier
a316869e7c
AGS: Correct spelling mistake
occured -> occurred
2022-10-27 15:56:08 +02:00
Hubert Maier
e5336d1400
AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:08 +02:00
Hubert Maier
255730b227
AGS: Correct spelling mistake
occured -> occurred
2022-10-27 15:56:08 +02:00
Le Philousophe
ab0854d81a AGS: Don't use unsafe sprintf and vsprintf 2022-10-23 22:46:19 +02:00
Le Philousophe
7f90669bdd AGS: Don't use unsafe strcat and strcpy 2022-10-23 22:46:19 +02:00
Thierry Crozat
f9e3580237 AGS: reimplemented clear division of clip position by sound type
Currently only MP3/OGG and WAVs are reporting correct sound type dependent pos.

Adapted from upstream 19bdee979c80f339d0ada0bee99b7517c8b595c5
2022-10-10 23:42:34 +01:00
Thierry Crozat
26716156af AGS: added AudioChannel.SeekMs() to coplement PositionMs
From upstream 59a5cacb8ed61e41dd8ef0641dd5de156caf8d32
2022-10-10 23:42:34 +01:00
D G Turner
0c2ae0357a AGS: Fix Signed vs. Unsigned GCC Compiler Warning 2022-10-10 08:40:27 +01:00
Thierry Crozat
58212aeebd AGS: added render callback AGSE_POSTROOMDRAW
This render stage overlays the room with objects and characters, but
stays within room transform, therefore will work with non-standard
viewport positions and multiple cameras.
The next closest stage is AGSE_PREGUIDRAW, which is rendered outside
room viewport. The new one fills the missing stage, lacking after the
viewport/camera update in 3.5.0.

From upstream 4ff7e14400ab81693fb64195d9ada70e979647ac
2022-10-10 00:16:16 +01:00
Thierry Crozat
c7f44082b8 AGS: more explicit code for the video flag parsing (PlayVideo/Flic)
This is just for easier to maintain / safer code.

From upstream ee2f91560969d22bd92a5e75af5a447937afb5c5
2022-10-10 00:16:16 +01:00
Thierry Crozat
6bae4af005 AGS: rename "multitasking" option to "background" and added cmd arg
From upstream cb83231c03764c74b8f8f09f8c876207a475f7b9
2022-10-10 00:16:16 +01:00
Thierry Crozat
2f8d4cb072 AGS: PlayVideo supports playing game and video sound together
From commit f2a9f3043aac24b0e70b48602a664541ec12df8d
2022-10-10 00:16:16 +01:00
Thierry Crozat
483ff1bc30 AGS: fixed object cache may sometimes keep an old dynsprite ref
This may result in object texture not updating if the old sprite was deleted but a new dynamic sprite was created right after having same ID.

Was broken by upstream 9dffb04 in 3.5.1, and also some later changes in 3.6.0.

From upstream 7ed51861898d864902b0f61b0cb7d0acadef1fe3
2022-10-10 00:16:16 +01:00
Thierry Crozat
6163d4880a AGS: fixed CompatKey may be "none" in some cases for valid key press
From upstream f0e699392866b1b737a6b5be08790cbddbc6767d
2022-10-10 00:16:16 +01:00
Thierry Crozat
9f24f6eda4 AGS: fixed ags_misbuttondown()
Complementing afdccb3d3 (upstream 471098d)

From upstream f6e23781c4895ab79b42f97324743356aa401eec
2022-10-10 00:16:16 +01:00
Thierry Crozat
bcb854370d AGS: key plugin callback and game. vars must use "CompatKey"
From upstream 555a3060491523d2c236f0bbb77b981eab2d4359
2022-10-10 00:16:16 +01:00
Thierry Crozat
0927821afd AGS: small refactor of key code variables (stricter names, types)
From upstream e04c8ff1fe77e4462babd21d2a103a12e68b4b84
2022-10-10 00:16:16 +01:00
Thierry Crozat
e2497cff42 AGS: include KeyMods flags in the WaitSkipResult
From upstream 65bfbb9bde733457b8ab958bb3cd273f7fadcb25
2022-10-10 00:16:16 +01:00
Thierry Crozat
250e32f9a1 AGS: adjusted InputType and KeyMod for easier packing in int32
This allows to fully pack InputType, KeyMod and KeyCode/MouseButton/etc in a int32:

- 8 bits (0xFF) - input type
- 8 bits (0xFF) - key mod flags
- 4 bits (0xF) - reserved (potentially for expanding mod flags, if that will be necessary)
- 12 bits (0xFFF) - KeyCode, mouse codes, gamepad buttons, etc.

Purpose:
1. Potentially allow to set keycodes + mods in an integer and assign to an integer variable/property, such as "skip key", instead of using existing "combo keys"
2. In fact, with InputType flags, this makes it possible to assign a mouse or gamepad button to the same variables.
3. Potentially allow to return keycode + mods from Wait* (currently returns only single key).

From upstream 0203e8feb73b96c501ac2439aa3fe3d6c182c8f4
2022-10-10 00:16:16 +01:00
Thierry Crozat
5987bc5e6e AGS: rewrote eAGSMouseButton enum to sync with the script API
* Changed from -1 - based constants to 0 - based constants;
* These were purely internal values, therefore no API would be harmed;
* Removed necessity of converting from internal mouse button code to script and back all the time;
* On a side note, this fixes a bug where WaitMouse etc were returning incorrect values on mouse skip, because we forgot to convert from internal to script code.

From upstream 471098d239b076c494beb2d554572ccb69372667
2022-10-10 00:16:16 +01:00
Thierry Crozat
06620b6e9f AGS: renamed Button's MouseButton enum to avoid name confusion
Was conflicting with the internal engine's eAGSMouseButton constants.

From upstream a5cfccee2d3681b55dafb8cfb9e0f38f84124855
2022-10-10 00:16:16 +01:00
Thierry Crozat
fa87b3f28f AGS: force update gui metrics on load and on game start
This fixes some controls not reporting their metrics correctly until first displayed on screen.

From upstream ea4e6762236a13621ba0771b9d5d8ac4bcf33ee8
2022-10-09 19:12:22 +01:00
Thierry Crozat
6f512bb2af AGS: Removed some redundant/obsolete comments
From upstream a7bd24cd4822bdcabef061197c98d1224200aa2a
2022-10-09 18:56:36 +01:00
Thierry Crozat
61e3a92963 AGS: fixed few more warnings related to typecasts
From upstream 7946be9e75a0edda6fc9d955ea771f60f9b8e968
2022-10-09 18:49:17 +01:00
Thierry Crozat
c1bfa68725 AGS: removed redundant global variable numBreakpoints
From upstream 5cb25832b1da27049fc3531f00aeb5727b98fc38
2022-10-09 18:45:15 +01:00
Thierry Crozat
5fd47e4055 AGS: define verbose sprite cache log through a macro function
From upstream a3e762c55b9424ebfc3f311b57ac30a8bcedf945
2022-10-09 18:34:44 +01:00
Thierry Crozat
7f6d7f41d4 AGS: use #if instead of #ifdef for log macros
Sprite Cache and Managed Objects produce a lot of entries in the log currently.
They use a macro to set if they should be on or not, but this macro may be set =0, with the intent of disabling.
Let's instead use #if when testing these macros.

Additionally

- only define DEBUG_MANAGED_OBJECTS if AGS_DEBUG_MANAGED_OBJECTS is true
- adds a new command line flag AGS_DEBUG_SPRITECACHE, which will only define DEBUG_SPRITECACHE if true
- guard indefinition through core/platform.h

From upstream e8bd58da2e09d844068dc087f1da153a693b7aa8
2022-10-09 18:11:02 +01:00
Thierry Crozat
026d1e83ac AGS: don't start sound fadeout if skipping a cutscene
From upstream d742c415a898e9c52875098f3f40ecffa57b22ee
2022-10-09 17:58:53 +01:00
Donovan Watteau
27f9a460b5 JANITORIAL: Fix "the the" and similar typos 2022-07-29 19:36:40 +03:00
Thierry Crozat
817ddb19c9 AGS: Tidied Library class
From upstream 58a6f421e3b97f6e2db49b88a6434686c62f5142
2022-06-25 23:33:30 +01:00
Thierry Crozat
57fb47275b AGS: Restored "Button::Animate^7" in API and fixed volume default
"Animate^7" was an intermediate API function during 3.6.0 alpha
development, and apparently there are games which used it.

From upstream eb4c0aec426c1501c84e93851e9aa31eaf8e2f27
2022-06-25 23:33:30 +01:00
D G Turner
a69311b4c1 AGS: Fix Signed vs. Unsigned Comparison GCC Warning 2022-06-24 23:12:06 +01:00
Thierry Crozat
119e09e56e AGS: Removed a too early call to pl_stop_plugins() and fixed another
There's one call in unload_game_file(), which should be called after
all objects that may have been provided by plugins are disposed
(fonts, managed objects).

From upstream 462cabe7353fc75f3cf70222a97028066f12f030
2022-06-24 20:54:47 +01:00
Thierry Crozat
b042a703d2 AGS: Hotfixed potential buffer overflow in check_for_messages_...
From upstream 22b7fe46365ba03863dc149248b7bbd6a3fbbc45
2022-06-24 20:54:47 +01:00
Thierry Crozat
f52c6a25ab AGS: Fixed forgot to save SetMultitasking in usetup.multitasking
Complements 3a4d94bf0

From upstream dd76b001a64105d1d7ad5b4878bbd646e19c6391
2022-06-24 20:54:47 +01:00
Thierry Crozat
e9c84767f7 AGS: Merged BitmapFlip with engine's GlobalFlipType (same values)
From upstream a747deafe67d536b6bcaf408077ca83f6e61a33d
2022-06-24 20:54:47 +01:00
Thierry Crozat
4f90db8fb4 AGS: Small correction to the hung script loop check 2022-06-24 20:54:42 +01:00
D G Turner
7f2f42e4a1 AGS: Fix Signed vs. Unsigned Comparison GCC Compiler Warning 2022-06-24 01:28:37 +01:00
Thierry Crozat
08db4be24c AGS: As a hotfix, restored the old way to test for hung script loops
The timeout method introduced by 6f665dfe is not working very well and
gives "false positives", so I'll disable it for the time being.

From upstream e0edb28b6606c360a1ea3fdcc487c2b05929ed02
2022-06-23 23:57:49 +01:00
Thierry Crozat
7372aa4040 AGS: Updated build version (3.6.0.28)
From upstream ad7c27a8bbf8a9e827ebd052472887cf4f47a299
2022-06-23 23:57:27 +01:00
Thierry Crozat
6f665dfe68 AGS: Test for hanging script using timeout instead of while loops
From upstream c34f0c96596f1a7814c15e7a06c2c498cb95ebfc
2022-06-23 23:57:27 +01:00
Thierry Crozat
aa9983c28d AGS: Update commented out exception handling code
This code is not used in ScummVM, but since it was still there in
comments it's probably better to keep it in sync with upstream.
The code was updated in upstream 0d1034df1a0e6593e7e61bbdb75d2996b8721b14
(tidy Direct3D renderer code, remove redundant parts, etc)
and 2f04e3b81db598eb7950668ce9d88a145f796f2c
(fixed Ali3DException's message string misuse)
2022-06-23 23:57:27 +01:00
Thierry Crozat
40c85968e1 AGS: Fixed restoring a exclusive fullscreen mode on switch in
Fixed getting stuck in a render attempt loop, because the window
events are not being processed.

From upstream 25329949f4d4a17ea8e6ad11fc7bd0ecccdfaca7
2022-06-23 23:57:27 +01:00
Thierry Crozat
29505204c1 AGS: Turned want_exit and abort_engine vars from int to bool
From upstream e924778ce3f88a4c821a4eecfea8edc353a6807b

In ScummVM they were already bools, but where still assigned values
of 0 and 1 instead of false and true in some places.
2022-06-23 23:57:27 +01:00
Thierry Crozat
3a4d94bf0b AGS: Updated Multitasking setting
* Added `[misc] multitasking=[0,1]` to config, acting as a *starting*
  setting, which may be changed by runtime call to `SetMultitaskingMode`;
* Ensure multitasking mode is overridden by connected external debugger
  (always on, if possible);
* Let multitasking mode work in "fullscreen desktop" gfx mode (still
  disabled in exclusive fullscreen);
* Now correctly reset multitasking mode if gfx mode changes.

From upstream 9f091926e393f75c90c951f9597710bf17395332
2022-06-23 23:57:27 +01:00
Thierry Crozat
dd9df96e74 AGS: Tidied code around debugger init a tiny bit, added log
From upstream 408f139d86b5d812fe3674901cadae6ae6573036
2022-06-23 23:57:26 +01:00
Thierry Crozat
8b8a7fffbf AGS: Tidied code around GameSetup a tiny bit
From upstream 850ae917fe7477dd83cc905cdb48982ef107877c
2022-06-23 23:57:26 +01:00
Thierry Crozat
305fdb853a AGS: Abort current scripts on close window event
This helps kill "hanging" scripts if user closed the window while
there's no real engine update.

From upstream a758fd6de2dccd0c948fc7f9e5b65200df902a65
2022-06-23 23:57:26 +01:00
Thierry Crozat
fe8c21366a AGS: Added comments to ScriptSystem
From upstream 9698d329e84ce4450aeb0bd3fbc3b43b8c29a3e2
2022-06-21 23:28:01 +01:00
Thierry Crozat
2389e64223 AGS: Fixed character's loop fixup in UpdateMoveAndAnim()
Was broken by 7a1ee192e2
Fixes bug #13477 AGS: Heroine's Quest intro shows portrait bug

This old commit was trying to fix a problem in old game(s), when
character was set to a loop with no frames. In such case the old
engine would seek for the first loop with frames, starting with 0.
The condition for doing so was made incorrect though: instead of
testing simply for a empty loop, it tested for frame number being
outside of the current loop's frame range.
This broke games where e.g. some walking view's loops were shorter
than the others.

A replacement is a condition that tests exactly for an empty loop
instead. The frame exceeding a loop's frame count is fixed later
along the way, so it's not a problem here.

From upstream ac73a555d737fb3f759cc7da9eeaf488a3bdcb2f
2022-06-21 23:28:01 +01:00
Thierry Crozat
5089b28645 AGS: Added more logging for multitasking mode, switching in/out
From upstream d3925672f5b96fab3308b606eb6f38dc279636d7
2022-06-21 23:28:01 +01:00
Thierry Crozat
76aebcd336 AGS: Tidy the quit message code and add comments
From upstream 3b4d21ab7025d4b66e7351639073f6d62e44f277
2022-06-21 23:28:01 +01:00
Thierry Crozat
025e89f6e3 AGS: Removed unused global variable
(could be remains of an old audio threading code)

From upstream a0424b98c6096da653824ec6fc03521f3583558e
2022-06-21 23:28:01 +01:00
Thierry Crozat
0c936b888d AGS: Fixed GUI textual controls not redrawn when translation changes
From upstream 618d2e38a118f47389aaf7e57972b2520b81fc1b
2022-06-21 23:28:01 +01:00
Thierry Crozat
4e9e0fcf15 AGS: Fixed parsing of legacy "game_scale_win" from 3.5.* config
From upstream 0e592f18546d3d65e2cf7822a4f7063278beef06
2022-06-21 23:28:01 +01:00
Thierry Crozat
f70d871748 AGS: Prefer to use override specifier where necessary
From upstream 0d41b5ef0e2dadf24a4618a496b43630981687ff
2022-06-21 23:28:01 +01:00