Commit Graph
101 Commits
Author SHA1 Message Date
Walter Agazzi 7abf9ab5fd AGS: Engine: fixed "mouse up" event could cause a recursive on_event
First "on_event" firing after mouse button is released may cause a sequence of blocking actions.
If there's any control checks during them, the global "wasbutdown" variable will be tested again,
potentially leading to a recursive "mouse up" event, except it's not run immediately, but scheduled
until after the first one has completed running.

For this reason "wasbutdown" must be reset BEFORE firing any events.

This was broken a VERY long time ago, it seems, probably by commit 2f54a16
From upstream ff1baccbffd8ee79fe3a5aff547e2ac7b8d8aaf5 (branch 3.6.1)
2024-05-03 12:49:51 +02:00
Walter Agazzi 42a26dc75b AGS: Engine: renamed cant_skip_speech to speech_skip_style for clarity
Also... the old name had inverse meaning to what the variable really did.
From upstream 44f1188992691c118aea15cffa0a73d6d4302601
2024-03-28 12:01:51 +01:00
Walter Agazzi c688b1d586 AGS: Engine: log warnings when Display or Say is called during fade-out
From upstream d7235fcef3c3ff042f9a4f9eed6ac0a250296927
2023-11-02 20:06:27 +01:00
Walter Agazzi 3cc56da41c Revert "AGS: Engine: don't Poll non-clickable GUIs"
This reverts commit c3589db569,
which breaks GUI functions in Kathy Rain
2023-11-02 20:06:26 +01:00
Walter Agazzi c3589db569 AGS: Engine: don't Poll non-clickable GUIs
From upstream 95a2ef2c0d6a4c04e3985d78920bfc4a70a641c0
2023-09-23 17:10:08 +02:00
Walter Agazzi ff0298be68 AGS: Engine: ignore mod and special keys when skipping speech and wait
Partially from upstream 8079c87ca11fa6b60ed2dd2ce345cda6c384c00b
2023-08-13 10:58:26 +02:00
Thierry Crozat e4be1e25dc AGS: Remove std::numeric_limits replacement
As per bc6b225eed, we can use std::numeric_limits
directly.
2023-06-05 20:18:16 +01: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 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
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 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 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 76aebcd336 AGS: Tidy the quit message code and add comments
From upstream 3b4d21ab7025d4b66e7351639073f6d62e44f277
2022-06-21 23:28:01 +01:00
Thierry Crozat 282ee9ad97 AGS: Fixing more trivial warnings
From upstream 83f7d9857e70f7d1d10fedf61196740d20ba0b0a
2022-06-18 01:08:54 +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
Paul Gilbert 6482e38803 AGS: CharacterExtras and MoveLists are stored in std::vector
From upstream 0c81cfefb788c0dcfdb2cad914f939f28110edca
2022-05-05 22:41:08 -07:00
Paul Gilbert 8e4254b839 AGS: Refactored walk-behinds calculation and texture generation
From upstream ac0c4cea6a6e41238fe74f0753fa6a458f05d954
2022-05-05 22:41:05 -07:00
Paul Gilbert 8d588c3a30 AGS: Fixed on_key_press not called all times
From upstream ffb73a0a7488e16b26c969b7efb3ca035f7dcea4
2022-04-29 22:20:39 -07:00
Paul Gilbert 0490236774 AGS: Use old-style keycodes for internal engine commands
From upstream e2f8b0f2357d2587016425ff6629ef37601d8e0f
2022-04-29 22:20:38 -07:00
Paul Gilbert 1ab42991d1 AGS: Added more event constants, clarified couple event calls
From upstream ae6862f7917832ebc5f2314561938c01725ac8a2
2022-04-25 22:11:42 -07:00
Paul Gilbert 09d4069428 AGS: Share animation cycling algo between Buttons and RoomObjects
From upstream fd28a2548e39c85478d98e26b51713cd687acada
2022-04-22 20:05:04 -07:00
D G Turner b59e24e117 AGS: Fix Cast Qualifier GCC Compiler Warnings
These are emitted if -Wcast-qual is passed to GCC.
2022-04-22 14:14:55 +01:00
Paul Gilbert 415235b74e AGS: expanded Button.Animate to feature all common params
From upstream 0853d4146276f86c7418dc02360deb49a0ef324a
2022-04-21 22:07:41 -07:00
Paul Gilbert 06880291b2 AGS: Refactor restrict_until and ShouldStayInWaitMode()
From upstream 434dd136b4e6628545677a17fc17c847efff1c71
2022-04-21 21:49:13 -07:00
Paul Gilbert e0282d5064 AGS: Implemented key handling switch (old/new mode)
From upstream b9e23731d0d792d095c1d4e83fa1797a1afeee46
2022-04-21 20:55:38 -07:00
Paul Gilbert e736059bbe AGS: pass key modifiers as an extra arg to on_key_press
From upstream b00b82220cbabf44185e042ef33b543fe2ad3543
2022-04-21 20:23:53 -07:00
Paul Gilbert c0010986ac AGS: Implemented on_text_input(int chr) callback
From upstream ba866abab0ba5a48b8577c4a01f0533a2d7e68de
2022-04-18 19:10:39 -07:00
Paul Gilbert b2d8bcad75 AGS: Refactor RunTextScript* functions for the purpose of clarity
From upstream 17af6ca2cb1fba310900f5189da788fa52ef7dab
2022-04-18 19:10:39 -07:00
Paul Gilbert af079a9c45 AGS: Handle all the buffered key events in one game frame
From upstream e489e187e88071c15fa64351852b8ede45f9f7ac
2022-04-18 19:10:38 -07:00
Paul Gilbert 8be58d3de2 AGS: Store game events in std::vector, remove event cap
From upstream a2f9a5ba94377686762b2828df4fccbe661d2b03
2022-04-18 19:10:29 -07:00
Paul Gilbert aeddd232e0 AGS: Removed animating buttons limit
From upstream 484f6d3f44c7dbb361ddeebd8bb46862760501bc
2022-04-13 21:55:18 -07:00
Paul Gilbert 8e3207b38b AGS: Moved frame wait and user input check outside of VideoPlayer
From upstream c5f815729792837b6b4a02c013c7c554942792d9
Only partially implemented, since ScummVM has it's own video player code
2022-04-12 22:27:57 -07:00
Paul Gilbert d147a541ec AGS: Cleanup some unused code/comments
From upstream f0dc4b364888f019c037afee6ee66aa0726fb560
2022-04-10 19:39:08 -07:00
Paul Gilbert 3425f8faf2 AGS: Moved couple of gui-related global vars into GuiOptions struct
From upstream 973d238a2c20368d8932ade22d2965d121cb7793
2022-04-10 19:39:06 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh a386075217 AGS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Paul Gilbert 80dbcd7fc8 AGS: Fix inventory scroll buttons in 5 Days a Stranger 2021-09-29 21:47:59 -07:00
antoniou79 d474ee3003 AGS: Change a few char variables to int8
In order to specify that they should be treated as signed

Some ports may treat an (unspecified) "char" as unsigned by default. Android does this for its ARM architectures and while we did fix this by enforcing -fsigned-char to its compiler, the issue may come up for other ports. Also it should be better to clarify in the engine when a variable is not actually storing string characters.

I've spotted and changed the most "safe" cases I could find for this. As far as I can tell, out of these, only the Outline field and fontoutline array could potentially be assigned valid negative values which would cause bugs for ports treating chars as unsigned.
2021-09-09 19:27:49 -07:00
Paul Gilbert d90cb0d203 AGS: Removed excessive headers containing random group of includes
From upstream 9e5149457a4638694fb1366b3fa59b08816f522c
2021-08-17 21:31:56 -07:00
Paul Gilbert 65f992979e AGS: Implemented Game.BlockingWaitSkipped
From upstream ce6bd0173f668932a0a5cab41119d2a476f7e73c
2021-07-27 22:03:38 -07:00