994 Commits

Author SHA1 Message Date
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 dec92f05ea9156961d17d9a7f62f11d73b8dba07
(e38df03c5d1658a2c44a26ba4ee6f22663c1e701 in upstream).

Some games do not have function arg count appended to the function names in
the export table; in that case `export_args` remained uninitialized.

From upstream cdbb7a7367db57e14983015232ecc97f6a3dd212
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