Commit graph

375 commits

Author SHA1 Message Date
Thierry Crozat
e9eba6ad20 AGS: Fix regression with translation setting change not saved
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.
2023-05-16 01:12:32 +01:00
Walter Agazzi
118f6fde0a AGS: When quitting with an alertbox, also print error to console
Minor QoL improvement for easier bug reporting
2023-05-02 18:44:56 +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
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
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
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
6565ca8530 AGS: Engine: allow VSync in windowed mode
From upstream bcf90697ac93080d0edac3e99727041a4e2b461a
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
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
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
7b5bcb881a AGS: Engine: fail when reading game data should return error
From upstream 416c456db0b20f5896506f86525faec0a353893f
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
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
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
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
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
2e9819ad4e AGS: Fix some overzealous renames
_GP(game) -> game
2023-02-24 21:13:17 +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
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
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
6bae4af005 AGS: rename "multitasking" option to "background" and added cmd arg
From upstream cb83231c03764c74b8f8f09f8c876207a475f7b9
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
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
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
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
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
7372aa4040 AGS: Updated build version (3.6.0.28)
From upstream ad7c27a8bbf8a9e827ebd052472887cf4f47a299
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
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
76aebcd336 AGS: Tidy the quit message code and add comments
From upstream 3b4d21ab7025d4b66e7351639073f6d62e44f277
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
fe80834639 AGS: Store DialogTopics in std::vector
From upstream 2609c0d1ee43a4f997021ce48ca2a4f70ca1a6c7
2022-06-20 23:52:25 +01:00
Thierry Crozat
e90fb00412 AGS: Replaced more strcpy with snprintf, for safety
From upstream 1b6cf053ebbe85e7ba6c5828e2582d757503bc16
2022-06-19 20:50:24 +01:00
Thierry Crozat
282ee9ad97 AGS: Fixing more trivial warnings
From upstream 83f7d9857e70f7d1d10fedf61196740d20ba0b0a
2022-06-18 01:08:54 +01:00
Thierry Crozat
d6d464f898 AGS: Fixed sprite cache limit was reset on sprite file open
From upstream 4f57730e2b3d41af4fd0300e8b092d31d448f544
2022-06-16 23:16:20 +01:00
Thierry Crozat
5d8c66c511 AGS: Implemented debug keys for saving/restoring a game
This may be useful in case the game does not provide any save system, or one is broken.
From upstream 86130ec92f6966cfa2d5565c749ba839acad8136
2022-06-16 23:16:20 +01:00
Thierry Crozat
703372b161 AGS: Fix regression with GUI translation option not working 2022-06-06 22:42:36 +01:00
Paul Gilbert
1933841f79 AGS: Removed numgui* variables, use size of vectors instead
From upstream 095cf9d77c96fb3a1f9e887d7aaa1ef1e92ebe60
2022-05-10 21:35:19 -07:00