Commit Graph
158 Commits
Author SHA1 Message Date
Walter Agazzi e946f9f99d AGS: Engine: fixed GfxDriverSpriteEvtCallback return value for no room case
From upstream e3bb8a85d2af9c425528eb7a2f16741e2de7b9ab
2023-08-13 10:58:26 +02:00
Thierry Crozat 22dae3061e AGS: Use C99 isnan instead of std::isnan 2023-06-06 09:00:36 +01: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 808e365805 AGS: Engine: fixed reset_objcache_for_sprite() resetting wrong char texture
This mistake was introduced early on in 7ed5186 and not fixed still in the later fix 38d0dd3
From upstream 1f27837ef14585d8050a4b49b46faa002f87a881
2023-05-14 23:04:38 +02:00
Walter Agazzi c98dd71ad6 AGS: Engine: when resetting objcache, invalidate spriteID, but not texture
Firstly, this is not necessarily optimal, as the next graphic
assigned to these objects may be of same size, in which case
the texture surface may be reused.

But there's another thing: there've been a bogus behavior in
the AGS, where a dynamic sprite, deleted right before the
room's exit transition, was still displayed for room objects (and
everything else really).
This is because although the sprite was disposed, the image
remained on a texture connected to these objects, at least
until the next object update. But object updates don't run
during room transitions, hence the effect.
From upstream 38d0dd3d7f0d6a4624d1f908f2e8d3c1abfee52a
2023-05-14 23:04:38 +02:00
elasota 5c5b456bfd AGS: Fix int-bool comparison. 2023-04-30 01:05:50 +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 2db380f1d1 AGS: Engine: save vsync property when the result is known
From upstream 178a25b4384c3c96998fc6750a3bc0b4ebda3e5d
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 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 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 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 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 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 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 bfc5f63026 AGS :Engine: draw fix, true means texture don't change
From upstream d5958eab884c079c00845c35e46ef0302152ded5
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 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 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 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
Hubert Maier f1c3261837 AGS: Correct spelling mistake
lightening -> lightning
2022-10-27 15:56:08 +02: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 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 e9c84767f7 AGS: Merged BitmapFlip with engine's GlobalFlipType (same values)
From upstream a747deafe67d536b6bcaf408077ca83f6e61a33d
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 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 5089b28645 AGS: Added more logging for multitasking mode, switching in/out
From upstream d3925672f5b96fab3308b606eb6f38dc279636d7
2022-06-21 23:28:01 +01:00
Thierry Crozat db1d5b17cd AGS: Tidy vsync setting methods in renderers
From upstream 5ff955152c43f6adfe03298a7cac069efffbee4d
2022-06-21 23:28:01 +01:00
D G Turner f567b0f96a AGS: Fix GCC Compiler Warnings 2022-06-18 14:10:00 +01:00
Thierry Crozat 282ee9ad97 AGS: Fixing more trivial warnings
From upstream 83f7d9857e70f7d1d10fedf61196740d20ba0b0a
2022-06-18 01:08:54 +01:00
D G Turner 8af2dc3a8c AGS: Fix Remaining Compiler Warnings 2022-06-17 12:19:37 +01:00
Thierry Crozat 13c3d6cddc AGS: Increased Room Objects limit to 256
From upstream b71f820c992d70ffef8f40b783ee4b53df634254
2022-06-15 22:13:02 +01:00
Thierry Crozat 48a1dfe68e AGS: Fixed renderer error if room backgrounds are of different size
From upstream 660857d193b9bcac3a7bb1bba70be8149b1e2d7e
2022-06-15 02:22:03 +01:00
Thierry Crozat 7382a1a551 AGS: Game objects use texture cache when possible
Specify sprite ID for shared textures for: characters, objects, overlays
GUI and GUI objects are more complicated, a they may contain custom
(generated) graphics; using shared textures for them would require a
bigger change in how their sprites are organized when gathering draw
lists for render.

From upstream b724b43fa7f13ea2e89a3e9213dd76b00e59f9f4
2022-06-13 00:30:21 +01:00
Paul Gilbert 3ac6998a98 AGS: Support Overlays not copying the image, but storing a sprite id
From upstream fd14bd4075bd9e6a577235f2434275b260250c46
2022-05-08 11:37:49 -07:00
D G Turner dbaa9439da AGS: Remove Various Unused Variables Causing Compiler Warnings 2022-05-07 20:41:45 +01:00
Paul Gilbert 8f0da16853 AGS: Re-enable std::move call in ObjTexture constructor 2022-05-06 20:16:42 -07:00
Paul Gilbert 7282304951 AGS: Script API: implemented room overlays
From upstream 65a7cd7e7566d3a1111be10b70dcb51b1853cd88
2022-05-06 20:16:42 -07:00
Paul Gilbert cf091f2d3e AGS: Replaced couple of variables in ScreenOverlay with flags
From upstream 38a4e8c262f0ec796225494fc939b283680caf57
2022-05-06 20:16:41 -07:00
Paul Gilbert b1649597d7 AGS: Replaced Math/std Min/Max with ScummVM macros
Inspired by 6dee5ee6f271c600e30879d892295ea6069e8cc9
2022-05-05 22:41:10 -07:00
Paul Gilbert 84a3925442 AGS: Simplified the use of get_overlay_position()
From upstream d673fb3822907fd01bf0e2c6f98bee04a8a5b17b
2022-05-05 22:41:09 -07:00
Paul Gilbert 97c12e8435 AGS: Merged Character and ObjectCache structs, and hid in draw.cpp
From upstream 753d47d975b10666702c47a22cbc4e68847787f1
2022-05-05 22:41:09 -07:00
Paul Gilbert a8ead540c5 AGS: GUIControl::CalcGraphicRect returns relative rect
From upstream f827c75396f433542b451ec4caaea4c41c22e5b2
2022-05-05 22:41:08 -07:00
Paul Gilbert a40ea44aa2 AGS: CharacterCache is stored in std::vector, hide in draw.cpp
From upstream 417879fce0dc27d458a73fedc20f311f3305f26f
2022-05-05 22:41:08 -07:00