Commit Graph
39 Commits
Author SHA1 Message Date
Walter Agazzi 7af9888de2 AGS: Engine: rewrote dynamic sprite change notification method
Previous existing method ran through virtually all the game objects that may reference a sprite, and
checked each one of them. Those who did reference the modified dynamic sprite were marked for
update and/or had their draw caches cleared.
Furthermore, for safety reasons, the Graphic properties of these objects were reset to 0.

This process was slow under two conditions:
- if there are alot of objects (especially overlays which may be created at runtime in large quantities);
- if there are alot of temporary dynamic sprites created and deleted per game frame (for example,
when drawing something complicated).

The new method:
1. We no longer reset object properties, this turned to be a bad design. There's another safety fix done
in the SpriteCache, which returns a placeholder sprite for any invalid sprite ID. This should make things
simpler and faster.
2. For the texture-based renderers, it turned out that updating the shared texture entries was enough
to make objects using them redraw. So for these renderers we don't need to reset any more caches.
3. For software renderer, introduced a GameState::spritemodified vector of bools. Whenever a sprite is
modified or deleted, engine sets a corresponding flag in this vector, and that triggers an update at the
next draw pass for all the objects that still reference that sprite.

GUI PROBLEM: because GUIs rendering is still different from other objects, even in texture render
mode, they are still marked for update the old way.
This should be addressed separately in the future.
From upstream 0b84a21cfb486e3a9fa03e6c2b354750742ed3fd
and 3f70782761a698a69d31af77833c05bf38eb7394
2024-10-30 18:07:42 +02:00
Walter Agazzi 528a0a333f AGS: Engine: consistently reset "mouse-over" when GUI interact state changes
From upstream 39147657c363d59ebfc9f9cb865ace0a38c95b90
2024-10-30 18:07:42 +02:00
Walter Agazzi b52fe376d1 AGS: Common: inlined several getters in GUIMain and GUIObject
From upstream 121a989b407542763553123f2a5a5fbd11b09e27
2024-10-30 18:07:42 +02:00
Walter Agazzi bd1bf59315 AGS: Common: hide GUIObject's size behind the get/set methods
From upstream ca442e0f9259d74a2bc6ccd7d28e59381ac1b9d1
2024-10-30 18:07:42 +02:00
Walter Agazzi 26167025c4 AGS: Engine: fixed GUI::TransformTextForDrawing() using translate flag wrong
From upstream 5ccf8214e98059737b76b813a10128f268ab2f77
2024-10-30 18:07:42 +02:00
Walter Agazzi 1c32a8538c AGS: Engine: force translate Buttons and Labels in pre-3.6.1 games
Most gui controls never had editable Translated property before (except ListBox).
From upstream 6990853cb659efd476126907ca30ca6e4eeffd00
2024-10-30 18:07:42 +02:00
Walter Agazzi 848d2b4ae5 AGS: Engine: support RTL in TextBox
From upstream b016b4c221afb4396d33684ef01412eaee7781d7
2024-10-30 18:07:42 +02:00
Walter Agazzi c05a1c4134 AGS: Engine: apply text direction based on guicontrol flags and game version
* If controls have "translated" flags
* For Buttons and ListBoxes: if game is >= 3.6.1
2024-10-30 18:07:42 +02:00
Walter Agazzi 24e8507116 AGS: Engine: support RTL in Button and ListBox
From upstream 24d9894f9bc9111af0714378e25ab12c2534e7fe
2024-10-30 18:07:42 +02:00
Walter Agazzi 90f94f74c0 AGS: Engine: reduced spriteset's [] operator use where possible
The spriteset's [] operator loads a sprite, but some operations may
 omit that and check the preloaded information instead.
This also makes it more certain where the actual sprite's bitmap is necessary.
From upstream df30fc1edd30d4f334addaf7883286e745dea2c3
2024-10-30 18:07:42 +02:00
Walter Agazzi 8aa46edc16 AGS: Common: account for Font's height when calculating ListBox and TextBox
Historically these controls could draw text beyond their vertical bounds too (in non-clipping mode).
From upstream c9572541a6f8d38ed2ca1ba7af8e235c5d56c8f2
2024-01-17 03:12:28 +01:00
Paul Gilbert da1178d905 AGS: Implemented proper HasAlphaChannel for all gui controls
From upstream 83306ee321e127368a41068f32bd4899ae00223e
2022-05-05 22:41:06 -07:00
Paul Gilbert ec170ebd2f AGS: More strict MarkChanged use for gui controls, on changes only
From upstream 1383ff33eb4620eae18598f96f7e0cc948977174
2022-05-01 17:23:22 -07:00
Paul Gilbert 2df62bdd55 AGS: Only redraw gui controls when they are marked as changed
From upstream 27a6bd6a13494cd670fb6749e5bd663f088487ea
2022-05-01 17:23:19 -07:00
Paul Gilbert 62ebde86a1 AGS: Gui controls draw themselves at requested offset
From upstream 9e9c8ffafe465b907ed0d22bcb1ba4df06803b8b
2022-04-29 22:20:40 -07:00
Paul Gilbert 403892950c AGS: Removed ListBox::DrawItemsFix, add preview items externally
From upstream af126ccdef791d6f97a65018bc3188e9767d399f
2022-04-29 22:20:40 -07:00
Paul Gilbert a6f42ad1ab AGS: Fixing various "unused va/arg" warnings + removed empty funcs
From upstream 61771ecd638338806c40d0da2bf1addea06cac90
2022-04-25 21:44:40 -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
Paul Gilbert dc3ce9f70a AGS: Renamed few font functions for consistent naming style
From upstream 9c355da410b734edc79212009a5e1be0b502c3b0
2022-03-22 22:30:13 -07:00
D G Turner 6d7663b1b1 AGS: Fix Redundant Declaration Warnings
These are emitted by GCC when -Wredundant-decls is passed.
2022-03-09 15:28:19 +00:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Paul Gilbert 91fa6ee386 AGS: Removed check_font() from GUI, as font handling is now safer
From upstream dc24ac2493026cfecfd0664a057f61f99f4b28ae
2021-08-20 21:49:38 -07:00
Cameron Cawley 9b348b3e7d AGS: Fix more type mismatches 2021-06-16 13:03:41 +01:00
Paul Gilbert eb1e337edd AGS: Removed String's "const char*" conversion operator
From upstream 7c426674e7e53bffe9120f8ffc059b77fa03a606
2021-06-13 21:08:59 -07:00
Paul Gilbert 701396361c AGS: Import of fresh codebase 2021-06-13 21:08:44 -07:00
Paul Gilbert 3a0a70bc43 AGS: Move more game.cpp globals to Globals 2021-03-10 21:01:11 -08:00
Paul Gilbert f05ad88320 AGS: Move gui.cpp globals to Globals 2021-03-08 18:41:26 -08:00
Paul Gilbert 1a8ae27b58 AGS: Move game & spriteset into Globals 2021-02-26 21:28:53 -08:00
Paul Gilbert cd017a73c7 AGS: Revert Standardization of number types
This reverts commit a96422af52.
2021-02-16 19:45:02 -08:00
Paul Gilbert a96422af52 AGS: Standardization of number types
This not only simplifies all the use of _t types to the
ScummVM equivalents, it gets rid of the int32 usage in
favor of just int, solving common type clashes with the
Amiga, for which int doesn't match int32
2021-02-13 11:38:55 -08:00
Paul Gilbert f6077152d1 AGS: More standardization of int vs int32_t 2021-02-06 22:22:04 -08:00
Paul Gilbert 65a2cf6687 AGS: Added engine/plugin/ folder 2021-02-06 16:37:31 -08:00
Paul Gilbert d8cb72494c AGS: Added engine/gui/ folder 2021-02-06 16:37:31 -08:00
Paul Gilbert 9a78e04039 AGS: Beginnings of engine/ inclusion 2021-02-06 16:37:31 -08:00
Paul Gilbert a7a9ca0543 AGS: Adding AGS3 namespace to cpp files 2021-02-06 16:37:31 -08:00
Paul Gilbert d8e471b03c AGS: Changing Common namespace to Shared 2021-02-06 16:37:31 -08:00
dreammaster 8026e4bb30 AGS: Run astyle formatting 2021-02-06 16:37:31 -08:00
Paul Gilbert bd6a58d1a1 AGS: Adding ScummVM comment headers 2021-02-06 16:37:31 -08:00
Paul Gilbert a60d290a08 AGS: Initial addition of engine/ and shared/ folders 2021-02-06 16:37:31 -08:00