Commit Graph
157344 Commits
Author SHA1 Message Date
Walter Agazzi 57464f3dce AGS: Engine: Complete "object interaction events take obj pointer and mode as params" commit
This completes cb6cce267d75ccdbca452873693a1ccadf0f688b
2024-10-30 18:07:42 +02:00
Walter Agazzi dcd7be5b2d AGS: Common: fixed sprInfo init in SpriteCache::SetSprite()
From upstream 9bb30c7973c138bee3efc3ba86e0f10175b9d1f7
2024-10-30 18:07:42 +02:00
Walter Agazzi df504348ed AGS: Script API: Restore leftover bindings
From upstream
720114e8a873dc69bf54de4148d2da77ae6561c6
c68e2b02ebddcd33184270cd95b66eb34521e1d1
2024-10-30 18:07:42 +02:00
Walter Agazzi ffe86114e4 AGS: Complete "query gfxdriver for texture mem" commit
Completes a7f392a8f08ec14c48297ee05dd0bd0edb765df8
2024-10-30 18:07:42 +02:00
Walter Agazzi e407658475 AGS: Engine: in hw draw mode always assume walk-behinds are sprites
From upstream a2cfb4b3708aab7ef0911772fa83921420485999
and
b1e3a485c3e8500923aa9395fb5af69e288d3c0a
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 59b44ac496 AGS: Remove accidental duplication in ResourceCache 2024-10-30 18:07:42 +02:00
Walter Agazzi e81c85c917 AGS: Engine: removed wrong cast to (char*)
From upstream e4fa97f8a7042b282a0a6ab504e731f1c32a7d93
2024-10-30 18:07:42 +02:00
Walter Agazzi ee6cf385c9 AGS: SpriteCache: corrected handling of "remapped" sprites
Remapped sprites are the sprites that were supposed to be present in the game
assets (according to the sprite index), but failed to load for whatever reasons.
The idea is that whenever a remapped sprite is requested, sprite cache should
return a placeholder sprite (sprite 0) instead.

This commit corrects the logic of this, where it would use remapped sprite index
one step earlier. This should fix incorrect duplicating addition of same "bad" sprite
index to the MRU list, and also saves little redundant actions where the LoadSprite
would reload the sprite 0 unnecessarily per each such request.

From upstream eca2e2d3b47a7fcf235690ee0ebda9058a662c91
2024-10-30 18:07:42 +02:00
Walter Agazzi 7edb641ff2 AGS: SpriteCache: store bitmaps in unique_ptr, tidy storage code a little
From upstream ccffbf65b7ea6c85f074ee8f42066102df95c93e
2024-10-30 18:07:42 +02:00
Walter Agazzi 2fbeea1840 AGS: SpriteCache: SetSprite() disposes old sprite in the same slot itself
From upstream 68f1e1a141e53c525b26e8b8f32f81eaa590d299
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 ee82074a47 AGS: Engine: further tidy up around agsplugin.h/cpp
* Moved plugin API event constants to a separate header agsplugin_evts.h.
Engine should not include whole plugin API, this is unnecessary, and may
 create naming conflicts.
* Moved SimulateMouseClick to mouse.cpp.
* Minor cleanup in agsplugin.cpp

From upstream 510293c1fd277d853544534423ceea27b8ae3e2d
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 60c4c2d484 AGS: Fix ResetDoOnceOnly registration 2024-10-30 18:07:42 +02:00
Walter Agazzi c00522563a AGS: Engine: store ScriptUserObject in memory similar to DynamicArrays
I realized this recently that SUOs were not registered in the script exports
properly. In AGS standards the object having a memory buffer should
register that buffer's address directly, so that it could be read and written
to directly. That is how strings, arrays, and any other structs are exported.
This also how the engine plugins can access the data if they use script API
to retrieve it.

There have not been any script API working with custom structs earlier,
but there is since 3.5.0 (few functions returning managed Point struct).
Plugins won't be able to use them correctly without this fix.

From upstream 9658c71528676acb386e2c638e782cc4e7d2afe5
2024-10-30 18:07:42 +02:00
Walter Agazzi 771872e338 AGS: Common: do not store temp load data in GameSetupStruct
From upstream 53d3e30563f8be5e3c1a08872a7d290761746729
2024-10-30 18:07:42 +02:00
Walter Agazzi 1847279274 AGS: Engine: small code clarification in walk_character() + more comments
There are no functional changes done here.
Partially from upstream 08fe531d3466eabc35d6de8fcb1b8514cdebae1a
2024-10-30 18:07:42 +02:00
Walter Agazzi e6c2b159a7 AGS: Engine: small fixes in ManagedObjectPool
From upstream 84949acf29bd95111c32facac536d0cac84e6782
2024-10-30 18:07:42 +02:00
Walter Agazzi 63f08f13a0 AGS: Engine: fixed data type in ScriptUserObject
From upstream 174da0b00eb9355acd381c51524a07187a8a1222
2024-10-30 18:07:42 +02:00
Walter Agazzi cd3a4d8287 AGS: Engine: implemented proper manager for CCCharacter script struct
From upstream a8eb1e173a87320d7fb6d4b29183c484fe80cc7c
2024-10-30 18:07:42 +02:00
Walter Agazzi 16cb64b080 AGS: Engine: implemented proper manager for ScriptSystem script struct
From upstream 7d309dad0eaeddca1612fbaacb8cc466b672e141
2024-10-30 18:07:42 +02:00
Walter Agazzi dd43bf35d6 AGS: Engine: implemented proper manager for ScriptMouse script struct
From upstream 487acd23845fda7be5ad29b17631878b7e1a7433
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 f13f7cfac2 AGS: Engine: rem the distinction between static/dynamic objects in script VM
From upstream 04450b2a41f0e0f107a4ea85dab375f439b4ffae
2024-10-30 18:07:42 +02:00
Walter Agazzi ac0422354a AGS: Engine: renamed ICCDynamicObject to IScriptObject
because this interface is now used for both Dynamic and
Static object managers.
From upstream 1bb14f7a2bae43534edf950c040bcd4a1be5f7df
2024-10-30 18:07:42 +02:00
Walter Agazzi 54b8b1d873 AGS: Engine: changed script object data pointers from char* to void*
This seems to be far more appropriate.
From upstream a495538a5e0106a655e4e04cf547be8ec9284d7c
2024-10-30 18:07:42 +02:00
Walter Agazzi 70dd8cb1f8 AGS: Engine: in RuntimeScriptValue store generic ptr as void*
From upstream 9d11b497907419ce9bf0ea47eb585bd748a3e027
2024-10-30 18:07:42 +02:00
Walter Agazzi 87caf7fd93 AGS: Engine: tidy CCStaticArray
From upstream 30c56a93d7e66974e3f86c687c2fe169f7de6b81
2024-10-30 18:07:42 +02:00
Walter Agazzi 5cb2873a83 AGS: Remove leftover files
This complements 1300d346e91d751feb3cfed51af76d214de8eaa5
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 935247b450 AGS: Engine: reformatted Camera & Viewport api's registration
From upstream ab9979251d4ce39dca7e28c5f95784fb405b5d00
2024-10-30 18:07:42 +02:00
Walter Agazzi 27ce106dac AGS: Engine: added a template ScFnRegister ctor for easier direct function
From upstream 78dcba2b8e874c3c313493e04dc0b83fdfb564cb
2024-10-30 18:07:42 +02:00
Walter Agazzi 20706c475f AGS: Engine: Complete move to new API registering
This complements the previous commits related to the upstream commit
9221ea54c1a81b9f37829d7fafc90ac2806d4eb1:
Engine: replaced script API registration with cleaner array tables
The benefits are:
1. Cleaner registration view, an array initializer instead of myriads of function calls.
2. Implicit distinction between static and object member functions based on prototype
detection, no need to explicitly pass a parameter or call respective registration function.
3. Enforced function registration for plugins, now combined with the regular registration
in one table entry, so more difficult to skip plugin variant
2024-10-30 18:07:42 +02:00
Walter Agazzi cec77078f6 AGS: Convert several files to new API registering 2024-10-30 18:07:42 +02:00
Walter Agazzi 813801779c AGS: Engine: Added new functions for API scripts registration
These can be used to gradually move to the new style introduced
in upstream 9221ea54c1a81b9f37829d7fafc90ac2806d4eb1
2024-10-30 18:07:42 +02:00
Walter Agazzi dfaa12c25a AGS: Engine: disable auto SetRestartPoint at startup
From upstream b6008e1265648a9ab491cd630057812a3f388717
2024-10-30 18:07:42 +02:00
Walter Agazzi 1ee7c47af2 AGS: Engine: fixed a condition in movelist_handle_remainer()
Should compare xpermove and ypermove using abs values,
as they may have different signs.
From upstream 234db6dc918490c1e2e4a82da8c6bd30987c227e
2024-10-30 18:07:42 +02:00
Walter Agazzi c66a1b5c98 AGS: Engine: fixed MoveList not getting cleared up on reuse, kept remainer
From upstream 03de6d3308d260a784d8b33cb1d9d987bb807299
2024-10-30 18:07:42 +02:00
Walter Agazzi f327ebdf1b AGS: Engine: replaced literal save version values with enum constants
From upstream 49b4d21b921dbdd6fc251a464a7b7c4c47035d66
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 14702fcc88 AGS: Common: use GUIButton::UpdateCurrentImage() consistently
From upstream 7989edbb4866af495fb7eb5b0142365f82aefb4b
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 9c7e414387 AGS: Engine: another small fix in do_movelist_move()
From upstream 354917c602144f5f1c902bfb44f970af860e799b
2024-10-30 18:07:42 +02:00
Walter Agazzi 4ef7d8af48 AGS: Updated build version (3.6.1.9)
Partially from upstream 2c111fcdc838452d11169c4877357d4d1f35cdc6
2024-10-30 18:07:42 +02:00
Walter Agazzi e3e6b75af5 AGS: Engine: reverted serializing movelist remainer, recalc on restore
Sorry for these changes, i decided that it's annoying to save the "fixup"
values used only in rare circumstances, that may be easily calculated
from basic MoveList members.
From upstream 13e59c4855a4ddcf9bfe5f935d6de1191debaf1e
2024-10-30 18:07:42 +02:00
Walter Agazzi 50b34a65c2 AGS: Engine: bit more refactor of movelist update, picked "move done" check
From upstream 36d18a543405b40f2259266707cc513e8e8f6646
2024-10-30 18:07:42 +02:00
Walter Agazzi 4799ff06d7 AGS: Engine: fixed silly typo in dataver condition in Character_SetSpeed()
From upstream 9ffaf228534fd305b8253ff2197f5c819ca49899
2024-10-30 18:07:42 +02:00