Commit graph

140 commits

Author SHA1 Message Date
Matthew Jimenez
1e99ce9d43 GRAPHICS: Use constexpr for palette constants 2025-02-26 11:11:43 +02:00
Walter Agazzi
dc30f4e2a8 AGS: Engine: Overlay uses ObjTexture similar to object and chars
+ fix free_dynamic_sprite in previous commit

From upstream 84432448725c77fbd3448a8d9c92e7e44e07a217
2024-10-30 18:07:42 +02:00
Walter Agazzi
1d70b396d2 AGS: Engine: store dynamic surfaces in unique_ptrs
From upstream 885df22361432d1d273e5f1dde4309b2d9ae38e1
2024-10-30 18:07:42 +02:00
Walter Agazzi
4e41e60781 AGS: Engine: store ScriptString in memory similarly to dynamic array
This potentially allows to access any metadata while passing string pointer around the script functions.

As a consequence: never wrap external buffer, always allocate your own.
From upstream 043758b1bb5116f038c5c597d17fe9524b92b3c2
2024-10-30 18:07:42 +02:00
Walter Agazzi
b498b14ecc AGS: Engine: save global draw method args in DrawState struct
Avoid query gfxDriver's properties all the time, instead save them once in init_draw_method() and use saved values.

From upstream db535512af65119d50ae3d6fb06c221d56f42d85
2024-10-30 18:07:42 +02:00
Walter Agazzi
1527b38a5c AGS: Engine: SpriteCache uses proper callbacks instead of hardcoded externs
From upstream 9354aaf7d105158418dfbc1ba67e75adcd9f89d4
2024-10-30 18:07:42 +02:00
Walter Agazzi
961b06447f AGS: Engine: use internal interface alias for plugin's object readers
The idea is to have similar interface internally in the engine, without having to refer to the
 plugin's API; at least to keep things consistent with the rest of interfaces for now.
 (The whole engine interface system may need to be reorganized.)

* Renamed existing ICCObjectReader to ICCObjectCollectionReader, an interface that supports
 multiple object types.
* ICCObjectReader is now an internal engine's alias for plugin's IAGSManagedObjectReader
(but it may be used for the internal purposes too if a need arises).
* Moved PluginObjectReader declaration, save 1 small h/cpp pair.
* Store pluginReaders in a std::vector, remove MAX_PLUGIN_OBJECT_READERS as redundant.

From upstream 49d037671e4daaa909a7a98e19456e0f29f8e3cb
2024-10-30 18:07:42 +02:00
Walter Agazzi
815041ec6a AGS: Engine: store game's ccInstances as unique_ptrs instead
The script handling part of the engine appeared to be too fragile and dependent on
 a precise timing of **deleting** a ccInstance.
For example, restoring a saved game may execute in the midst of the call to
RunScriptFunction(), at the "post script cleanup" stage, while there are still references
to ccInstance on the engine's call stack (and few other places). If anything prevents
 ccInstance's disposal at this moment, that would in turn lead to logical errors due to
  the game scripts "instances" counting. The most outstanding consequence is that the
   script exports are kept pointing into the deleted memory and not re-registered after the save is restored.

Overall, the script handling part of the engine would benefit from a major refactor,
 with a goal to make it safe and consistent, but this is not something I might do at the moment.

From upstream 1f6abf4b678f77825c710d4ae18b57ff8f882c93
2024-10-30 18:07:42 +02:00
Walter Agazzi
09ffee9ed7 AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances (take two)
After the updates to cc_instance this should now work

From upstream b1e4f75141ce88b3146f55ecd9d7a95378428072
and 49e8aa0b566dea4ce025f9530a9f2392dbe67a33
2024-10-30 18:07:42 +02:00
Walter Agazzi
3bf6572826 AGS: Engine: implemented proper manager for GameState script struct
From upstream 8360a2c354b51542eb68ae5f5fcd9153de1cdb83
2024-10-30 18:07:42 +02:00
Walter Agazzi
795dacac07 AGS: Engine: inherit StaticObject managers from ICCDynamicObject
This removes an excessive separation between "static managers" and "dynamic managers",
and let use the single ICCDynamicObject interface when working with both kinds.
Simplifies RuntimeScriptValue and StaticArray classes.

Picked out most common implementation into CCBasicObject, which is inherited by
AGSCCDynamicObject and AGSCCStaticObject.

From upstream 781632881dd64af2b57b789617da15107bca9451
2024-10-30 18:07:42 +02:00
Walter Agazzi
22cb981566 AGS: Engine: rewrote MoveList to avoid packed shorts
From upstream d463adac63817fd08eb757038f90c730726124d3
and 09203df6efb19cf0f2eafd098c798733bd85cfe0
2024-10-30 18:07:42 +02:00
Walter Agazzi
9c633e250e AGS: Engine: cut out DebugConsole implementation, as unusable
This "console" implementation has multiple issues, making it unusable in practice:
- saves and displays only few lines, cannot scroll back;
while multiple game messages may be printed per a single game frame;
- messages cannot be filtered at runtime;
- uses a game font of a fixed number, which in unreliable (as the font may not be suitable);

There's not much value in its code; if a new console will be wanted in the future, then it
would be best to reimplement one from scratch, but with a good planning first.
From upstream c303590efca4632fef0fb2ab3143faba6e605ba8
2024-10-30 18:07:42 +02:00
Walter Agazzi
5b66b860af AGS: Engine: separate functions for getting game's set and real fps
From upstream cacaa9be6f7a0194b89fd2255acc9b8b612622b4
2024-10-30 18:07:42 +02:00
Walter Agazzi
f9087ab378 AGS: Engine: optimized ScreenOverlays storage (vector variant)
Keep ScreenOverlays in std::vector, but do not erase elements
 in the middle and invalidate them instead. Record free indexes
 in a helper stack.
 When creating a new overlay, first check for the recorded free indexes.
Overlay's type now equals storage index.

This speeds up both creation/deletion of overlays, and their access.

Removed the gap between "fixed" overlay types and custom ones,
 to save space. If we ever need more special overlays, these could
 be created as custom and their ids saved in a variable (similar to
 how background speech works). Previously present special overlay
  types are left for backwards compatibility (and to simplify the transition).
  From upstream f7d2f162fa55aa1b6f37195d890ebe047a204154
2024-10-30 18:07:42 +02:00
Walter Agazzi
3d1e23b2a1 AGS: Engine: remember overlay index and try it before looking again
From upstream 8fffaf0b6f844b946dc4bb1ad92c8dd14294fead
and 34ef9bf5f271411e72b5ebd062482b60e391593b
2024-10-30 18:07:42 +02:00
Walter Agazzi
8153a59121 Revert "AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances"
This reverts commit 016323f1f9797827a36a77ae3a5859b56d3b0998.
2024-10-30 18:07:42 +02:00
Walter Agazzi
253187f4e2 Revert "AGS: Engine: store game's ccInstances as unique_ptrs instead"
This reverts commit 547cd40186876f17914f6a96261aaf5c4dfc21b4.
2024-10-30 18:07:42 +02:00
Walter Agazzi
b1e7617964 AGS: Engine: store game's ccInstances as unique_ptrs instead
From upstream 1f6abf4b678f77825c710d4ae18b57ff8f882c93
2024-10-30 18:07:42 +02:00
Walter Agazzi
4019f9305b AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances
From upstream b1e4f75141ce88b3146f55ecd9d7a95378428072
and 49e8aa0b566dea4ce025f9530a9f2392dbe67a33
2024-10-30 18:07:42 +02:00
Walter Agazzi
5acc31c4ed AGS: Engine: remake LipSync arrays into std::vectors
From upstream b4f937a5c9900c0b05ef6ae2bc6051e970c2889a
2024-10-30 18:07:42 +02:00
Walter Agazzi
c0cc23c570 AGS: Engine: remake ScriptGUI and ScriptDialog arrays into std::vectors
From upstream bc44a84892128250ebb08576e4640d0a2858d436
2024-10-30 18:07:42 +02:00
Le Philousophe
49b4c1b3c4 AGS: Revert to use std namespace
This allows to minimize changes from upstream
2024-07-08 21:37:28 +02:00
Paul Gilbert
c2a476411c AGS: Move std namespace into common/std/ 2024-07-07 15:28:31 -07:00
PushmePullyu
13b7608492 AGS: Replace local static "last_cutscene_script_pos" with field
Fixes #15015
 "AGS games lead to a reproducable crash on exiting ScummVM"
2024-03-18 12:39:59 +01:00
wyatt-radkiewicz
e416492a06 AGS: Now engine can detect AVX2 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
6c353ba72b AGS: Use main SIMD detection features 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
29a0903e5b AGS: Holding off PowerPC blitting optimizations
I'm taking GSOC in a slightly different direction. I will finish the
PowerPC blending/blitting optimizations, but first I'm going to focus
on the general Graphics::Surface and Graphics::ManagedSurface code for
now.
2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
f53e39bac4 AGS: Fixed last commit 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
bdbceeb674 AGS: Fixed PowerPC code not compiler under GCC 6.59.21 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
ff72736c49 AGS: PowerPC Altivec: initial support 2023-08-28 21:16:42 +02:00
wyatt-radkiewicz
ace1a346cc AGS: Finished SSE2 blending optimizations
Finished writing the code in surface_simd_sse.cpp. I also added a backup
option in case no processor simd extensions are found. In that case it
just defualts to the normal drawInnerGeneric. I also made
drawInnerGeneric a bit faster by moving certain things into compile
time. Tests were changed to also include SSE2.
2023-08-28 21:16:42 +02:00
wyatt-radkiewicz
45f093f4be AGS: Fixed SSE2 detector and unoptimized draw. 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
0d29563122 AGS: Started on SSE version 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
b177d382b6 AGS: Moved arm neon bitmap code to new file. 2023-08-28 21:16:42 +02:00
Wyatt Radkiewicz
673cb4d659 AGS: Optimizations turns off if SSE is not found. 2023-08-28 21:16:42 +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
Thierry Crozat
fe80834639 AGS: Store DialogTopics in std::vector
From upstream 2609c0d1ee43a4f997021ce48ca2a4f70ca1a6c7
2022-06-20 23:52:25 +01:00
Thierry Crozat
b948d94ce2 AGS: Implemented dialog_options_close callback
From upstream 88cb130d1063bf5268bbcae29ffaae37324f5a30
2022-06-19 00:46:56 +01:00
Thierry Crozat
74416f547f AGS: Removed redundant arrays keeping copies of obj script names
From upstream f0887ba798b9df7aa70125b432efd5d62c64a622
2022-06-15 22:13:02 +01:00
Paul Gilbert
4d15fc94c8 AGS: Refactor ScummVM GfxFilter from being static global 2022-05-31 21:04:19 -07:00
Paul Gilbert
b47407e804 AGS: Fix shadowed StringMap warnings 2022-05-31 18:35:39 -07:00
Paul Gilbert
7282304951 AGS: Script API: implemented room overlays
From upstream 65a7cd7e7566d3a1111be10b70dcb51b1853cd88
2022-05-06 20:16:42 -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
a40ea44aa2 AGS: CharacterCache is stored in std::vector, hide in draw.cpp
From upstream 417879fce0dc27d458a73fedc20f311f3305f26f
2022-05-05 22:41:08 -07: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
8e132f7b3f AGS: cc_error returns stack from all script threads
From upstream 9e76800d668d8d0af7d47d815e6d1b781c7601f6
2022-05-05 22:41:07 -07:00
Paul Gilbert
16d0d89787 AGS: Grouped ccError variables in a struct
From upstream 48ef387226e4d420dc62d0a0b204cf4cd89a1139
2022-05-05 22:41:07 -07:00
Paul Gilbert
a2a5f2575d AGS: Reorganized few cc_ headers
From upstream ea1f8b9ece69fc7c49c4d3aa7b9af51c4ca736e5
2022-05-05 22:41:07 -07:00
Paul Gilbert
480be2134b AGS: Added script instance thread stack, replacing current_instance
From upstream f3443cb7a4ae5858e5d2d28131aaf6cf138bc0ec
2022-05-05 22:41:06 -07:00