Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AGS: Commits from upstream up to version 3.6.0.47 #4929

Merged
merged 56 commits into from
Apr 29, 2023

Conversation

tag2015
Copy link
Contributor

@tag2015 tag2015 commented Apr 22, 2023

This PR includes the commits from upstream AGS up to version 3.6.0.47,
which is the current stable release for the 3.6.0 branch.

Skipped commits:

add explicit includes for stdexcept

Engine: in software renderer, track rendered batches without stack
Already implemented in previous commit

D3D/OGL: refactored RenderSpriteBatches based on soft-render changes
D3D/OGL: do SetRenderTarget only when rendering some sprites
Different implementation

Engine: fixed apeg_display_video_frame() return value is unused
ScummVM does not use apeg

Engine: force gfxdriver to clear batches when releasing render targets
Engine: also release render targets when switching in fullscreen
Direct3D: throw if TestCooperativeLevel returned unexpected result
Direct3D: recreate any existing render targets in case of device reset
Different implementation

Engine: implemented relative movement in our Touch2Mouse code
Engine: separate config setting for touch2mouse abs/relative mode
Engine: in config write touch-to-mouse mode as a string value
Engine: add an option to ignore certain mouse device by ID
Engine: touch2mouse emulation clamps to window and syncs with mouse pos
Touch2Mouse not implemented in ScummVM

Engine: fixed mbstowcs and wcstombs to terminate the string
Engine: disabled mbstowcs() and wcstombs() placeholders
Already removed

Engine: fix Windows ex-handling format for size_t should be %zu
Not present

Engine: System_GetAudioChannels missing index in error message
Already fixed

Engine: check _capsVsync in DoesSupportVsyncToggle()
Not needed

Engine: fix Windows ex-handling for 64-bit builds
Not present

D3D9: fixed crash when initializing, because using device ptr too early
D3D9/OGL: safety hotfix removing deleted RTs from backup draw lists
Different implementation

Engine: fix touch events not working in iOS Safari
related to Touch2mouse

Engine: in SDLDecoder/OpenAlSource keep posMs in floats, less rounding
Engine: tiny correction to OpenAlSource::GetPositionMs()
ScummVM uses his own audio code

Engine: couple of helper functions for testing PlaybackState values
Different implementation

Engine: Fixed incorrect bound in error message
Engine: fixed find_free_audio_channel() incorrect compat fix
Already merged

…er()

From upstream dc22dfcd09f5e29aae8fefbbfe3c6cb0aca97937
…o Rect

Can't remember why did I make it so, the Rect is enough for now.
From upstream f7a408d6cea65a5279f3b5b4e980c87bc1e381ca
…wport)

This fixes legacy letterbox for Direct3D/OpenGL renderers.
Partially from upstream 29b62232b9c595cc05b5c6872e97544c1204f2b0
From upstream 362ea919e9ffaf2407299fbf4e7815bc43ceac4c
From upstream f4f715f26c83be708da9c7dbfdcb0fa3196624b4
…batches

From upstream 5446f80a4c95d4581991a52ea54781820f28244f
…ches

Partially from upstream 975e2192bce136d81275c93310d3de200de1bfba
Partially from upstream ae559b469fc5dc4b01d3497f5ca13c2961c98c82
From upstream 9c9277dae1b56650b7022a824579626cfdb62728
Partially from upstream 8e38f612d8b8fe834bdc8a55bb5ef543e6b45cb8
Partially from upstream 7ad4f424f473f480c830faf3f7a2aca4388aa8fe
From upstream 84730a4bbfb971855c667241a9a47745f283f12e
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
This completes commit c06dc7d which was only
partial and completely broke the mouse pointer and UI in old games
Partially from upstream 0432b26a2b875b7ee36f32fb321342d11901c459
Was broken by 0f19fc3
From upstream 899b6be0ea088737799e075e7906bc3308108699
- with FileStream::FileCloseNotify we can run an event when a file closes
- the arguments are a struct so we can expand them later if needed easily

From upstream 2c170cacb84f56004d86d8e981710777c9c09554
These are the only relevant changes from upstream:
62b2f42b53010f9db17a89365d4db73eeb5056d7 and
33a2417f2d63638e87e9a6199b571a7929664722
From upstream bcf90697ac93080d0edac3e99727041a4e2b461a
Partially from upstream 8dce503b05728edabe6205e7fbf3f660ed31e957
Reimplemented from upstream f7cf17e279ad44e94fadf21b7922b35dd9134fa2
From upstream 07d72ac3e1c89883c9e9430a22596ac19c3c58b1
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
… 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
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
… failed

setlocale equivalent is not actually implemented so this does nothing
From upstream f4bd0604c73aad7ecf05bf6e3f22dbe161434b2c
From upstream 528c1374cee8d8e09654dc5d01698984dd29568a
Partially from upstream 8cde9d29c1854a7baee489829fa36fdfa8c41a93
This is because of legacy AnimateObject behavior, which treated IDs >= 100
as a command to run AnimateCharacter(ID - 100) instead.

From upstream 8365802092cd3f704aecffe7d08b4d9f65f1f396
Partially from upstream 5518f00ba54680d9e314d192f4afc433519f2afa
Partially from upstream 9a1221e7c11326c6ae469285f62dbe3a0a1e4c32
From upstream a746ae013e8874c816cedf24c89452c25fc189a0
From upstream 3653e184243e0eb6b559726c6b33b1e55f52d1f4
Screen limits are hardcoded in ScummVM's implementation, so this function
does not really validate anything
Partially from upstream cbe729f93c9b204db41ddd1b28c455d4a98ff703
…liers

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
This is not implemented and just add a  stub
Partially from upstream 82b19ca27b682c497422ad8eac532ceb88c67e62
…ncImpl

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
Partially from upstream 5a867c211abf3e288259e8103b2f948eb354aac4
This fixes internal mod key counter not being reset, which
may break service key combos (alt ctrl, and so forth).
From upstream 142e1aaa11e7de2995ddfd24c3f1df0ae6c1b072
From upstream 178a25b4384c3c96998fc6750a3bc0b4ebda3e5d
Partially from upstream cdb0b7fef561aa5badc3522342e2f0b1d20d0b4d
…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
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
* minstalled -> Mouse::GetButtonCount();
* msetgraphpos -> Mouse::SetSysPosition() (internal);
* mgetgraphpos -> Mouse::Poll();
* msetcursorlimit -> merged with Mouse::SetMoveLimit();
* msethotspot -> Mouse::SetHotspot().

From upstream 9211b07f36528776e6fabc34a29405b6d63f6c23
…te 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
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
Partially from upstream 2b03d989c8ac5de3dac49b483bd216aaeb807354
…sive)

From upstream 2de0701f47cb189b51aa429cd8ef4812b6dae9ef
Use uint32_t, because these libs were written for 16/32-bit
systems originally. (these longs are mostly pixel values)

Partially from upstream 8b918708e52797c3c954c1a3df65119c9a1d3aa9 and
861e394bce389cbf769f433194c55d826993d0b4
This is long overdue since String class changed int indexes to size_t.

From upstream b81f9e31e8b8bbbbf46e570427d16deea5102d3a
Use int32_t instead of long.

Partially from upstream 2f1e73e3b830b3db874148a5a6215c6c270c6a94
  Use term "engine" instead of "ACI" (a legacy "Adventure
Creator Interpreter" title).
From upstream eaf298ae3f96db6e37bfd9ac99bad1dff48430ae
From upstream 4392ef832f131c8fd1e5ded00b095f78cf4815ca
From upstream 95c4362271734c5cb724b314d7cc555f752e06a8
…ting

From upstream 9634b6d3613f2b066998eaaf853945017f59fa01
Partially from upstream 820ee6c41427e3529a22ef46ac2799297a050876
@tag2015 tag2015 requested a review from criezy April 22, 2023 23:07
@sev-
Copy link
Member

sev- commented Apr 29, 2023

Absolutely great work!

@sev- sev- merged commit 74b5ea9 into scummvm:master Apr 29, 2023
@tag2015 tag2015 deleted the ags_from_upstream_new branch April 29, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants