Commit Graph
122 Commits
Author SHA1 Message Date
Walter Agazzi f1dcf66ad3 AGS: Engine: added AudioChannel's playback state to saves
AudioChannel.Pause and Resume commands were added back in 3.6.0,
but I forgot to write the paused state to save format...
From upstream e18091c2f32a057d4c6538b9b26e4f31ef9b6296
2024-11-27 16:45:50 +01:00
Walter Agazzi 6814c8dbe2 AGS: Engine: support loading 3.5.0 saves with mismatching "Room States" ver
From upstream 02281846f8d25041b6179617eba4bd65ffef0cc2
2024-10-30 18:07:42 +02:00
Walter Agazzi 2d2755f491 AGS; Engine: changed ScreenOverlay to store owned images as dynamic sprites
From upstream 4728d57086b7eedf112796da011f3c7b0dd3ad30
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 3078b207d3 AGS: Engine: refactor around add_dynamic_sprite()
* separate variant of add_dynamic_sprite() that searches for the free slot itself,
not requiring user to do this;
* the previously existing variant is used for: replacing modified dynamic sprite
and restoring sprites from save.
* add_dynamic_sprite() accepts unique_ptr<Bitmap>, explicitly saying that the
ownership will be taken by the spriteset.
* sprite info and SPF_* flags are set inside spriteset, instead of hacking them in
add_dynamic_sprite().
* simplified LoadSaveSlotScreenshot()

From upstream 0913f49e4212fea3a48539251ffc1ab92518a231
and aca47b9f466fe41d73d99a15b9f0ae41e65c6926
+ minor changes
2024-10-30 18:07:42 +02:00
Walter Agazzi e6ea49d9d3 AGS: Engine: fixed restoring letterboxed viewport after loading an old save
From upstream 027d724427c7460ace03b6cc7e23a4cc7ccf6e5b
2024-10-30 18:07:42 +02:00
Walter Agazzi 73526c8f1c AGS: Engine: add SPF_OBJECTOWNED flag for dyn sprites owned by Overlays
Currently this is only to skip checking them when exiting the game.

Partially from upstream f535a4b7fec65bb00b13c883a0b3e1154509f651
2024-10-30 18:07:42 +02:00
Walter Agazzi 8b7b0df59c AGS: Engine: fixed MAX_WALK_AREAS value
From upstream 39228483259a05a3e3a5d60bc1330a90bef6ae75
2024-10-30 18:07:42 +02:00
Walter Agazzi 87c0bcdf7f AGS: Engine: fixed CharacterInfo breaking script compatibility again
This fixes a mistake introduced in commit 4be1556, which in turn followed b02814b

The problem is, that CCStaticArray does not work as intended, and seems won't (at
least not without some extra workarounds).

When the script compiler is told to get an Nth element of a global struct array, such
as character[n], it calculates the memory address as
    Character* ptr = (array address + sizeof(Character) * n).
If this address is used for the read/write operations, these ops can be intercepted by
interpreter and remapped into the real fields (see IScriptObject::ReadN, WriteN
interface).
But if this address is used IN POINTER COMPARISON BY VALUE, then we cannot do
anything. And if our real struct in the engine is stored on a different relative memory
offset than one expected by compiler, then this pointer comparison will fail.
This breaks script expressions like e.g.:
      if (player == character[n])
From upstream 97ed18e95b587544ae47497f0a5f1d1ba00a7e29
2024-10-30 18:07:42 +02:00
Walter Agazzi 5b793dbd38 AGS: Engine: new plugins save format, stores name & data size per plugin
From upstream e84746a5049b2855cd0774ba0ff641753f640c27
2024-10-30 18:07:42 +02:00
Walter Agazzi 50e11cf086 AGS: Engine: basic stream range safeguard for plugin serialization
Reimplemented from 99ae439a1dbdca965c58f69894b623de536f5163
2024-10-30 18:07:42 +02:00
Walter Agazzi d0fe6fd80e AGS: Engine: remade writing of non-fixed Character name in game saves
Done for more consistency, so long as CharacterInfo and CharacterExtras are
separated structs.

WARNING: this breaks the saves made in 3.6.1.14 (Beta 15)...

Additionally, done so that legacy scriptnames are not loaded from current saves,
since these are supposed to stay fixed throughout the game (at least unless
characters are created dynamically, which they currently are not).
From upstream c15603adface26d3ea44519f07f4992c3201ad53
2024-10-30 18:07:42 +02:00
Walter Agazzi e158764267 AGS: Engine: unrestricted game name and save folder name
From upstream 3b06711da90621b2ee5ba33ff82da91f797cabbb
2024-10-30 18:07:42 +02:00
Walter Agazzi 8d6ba11854 AGS: Engine: add unrestricted Character name to saves
NOTE: appended this new field to the end of character save chunk for consistency.
But because the field itself is in the CharacterInfo struct, I have to pass CharacterInfo
reference into CharacterExtra::ReadFromSavegame().
This is ugly, but but should be improved when the structs are refactored into having
a distinct runtime Character class.
From upstream 5cedf554b211957d7b413a4ef7608f0748384b0e
2024-10-30 18:07:42 +02:00
Walter Agazzi 51de20d796 AGS; Engine: drop support of pre-3.5.0-alpha movelist format version
This version was in public pre-alpha release and stayed for 3 months
before being replaced by an updated format along with the new A* pathfinder.
From upstream ac41f53a9c40f2ceb9e3f80eb219faabfeb3da43
2024-10-30 18:07:42 +02:00
Walter Agazzi 796796e8f3 AGS: Engine: cleanup some mentions of AlignedStream
From upstream 1ba008ae8260e614d2d2506ee04a02e4dabfbfc8
2024-10-30 18:07:42 +02:00
Walter Agazzi 8b4e30fa35 AGS: Engine: hardcode alignment padding in remaining legacy save parts
From upstream b3951c9d8c8cfdd75c4a1f412735de76e1476ceb
2024-10-30 18:07:42 +02:00
Walter Agazzi bfed6e06e5 AGS: Engine: separate CharacterInfo read/write for saves, no padding
From upstream c9d48a1c8da3dbcc49d483973b8a478925ea195a
2024-10-30 18:07:42 +02:00
Walter Agazzi 67b9b8f6d3 AGS: Engine: fixed save ver constants for Characters and RoomStates
From upstream 78713266a4316f59b13fbe0c880fbeb6c4764054
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 dadd1500ef AGS: Engine: save MoveLists as a separate component, store onpart fixed-pt
Backport the good idea from ags4, where movelists are written in their own save file
section, as separate data objects.
Remember that we have to keep loading them from within Character/Room data in old
saves though.

Save `onpart`member as fixed-point value. MoveLists from old saves have to convert it
from integer.
From upstream 216bf453ec007d8d1545315837c6beadb49bc52f
2024-10-30 18:07:42 +02:00
Walter Agazzi b318d39e0b AGS: Engine: tiny cleanup in ReadDynamicSprites()
From upstream b257a0cd32a84fbb63d6b03cfbd10f3cc5732caa
2024-10-30 18:07:42 +02:00
Walter Agazzi aedaa4ce88 AGS: Engine: fixes for overlay id comparisons
From upstream 11f0448681ae1370b8b5d58f33efc528916a6112
2024-10-30 18:07:42 +02:00
Walter Agazzi a010fddc55 AGS: Engine: safety checks for invalid id when reading overlays
From upstream ed520227cea80bd2503451b61780b4e6be962cc3
2024-10-30 18:07:42 +02:00
Walter Agazzi 9cd644115a AGS: Engine: fixed overlay read and write in a save: don't save empty slots
From upstream 05638253550f7bd1089cfd3670078cd2157d9d92
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 d8d4a77724 AGS: Engine: hide "screenover" vector behind interface functions
From upstream 3b049092875293b0960013910586f3adb017c862
2024-10-30 18:07:42 +02:00
Walter Agazzi 6b2af4cced AGS: Engine: picked out plugin's save / restore data event runs
This is not precisely a part of a particular save format, but rather a command to plugin callback system.
In theory it might be also possible to implement step by step reading and writing with some engine's action in between.

From upstream df0151983e077e577eee8691a61d03be44c24cbd
2024-10-30 18:07:42 +02:00
Walter Agazzi 3a5ccd4cba AGS: Engine: moved dynamic object management functions to a separate unit
From upstream 1a9df937e3ac9eba0c2f5b663507a52569d635e0
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
Walter Agazzi 40e79d9e20 AGS: Engine: in legacy read save functions take game data ver as an argument
From upstream 8e280225f2c73980034db6866696f40d7bb63ad8
2023-09-02 13:23:59 +02:00
Walter Agazzi 07bbbcd233 AGS: Engine: replaced couple more shared_ptr<char> with vector<char>
From upstream 1cccdfea5c1009123de7ba25be72b2757f74d06f
2023-03-12 20:58:28 +00:00
Walter Agazzi 9a469f1e2b AGS: Engine: support fixing up RoomStatuses restored from older save formats
This allows to properly fixup (upgrade) RoomStatus structs
restored from a older format save in an upgraded game.
For example: game was upgraded from 3.4.0 to 3.6.0, but player
tries loading 3.4.0 save. In this situation the engine must know and
keep track of what version each RoomStatus was saved in.
This is necessary, because RoomStatus can only be updated upon
loading a corresponding room file (when entering a room). This
means that multiple RoomStatus objects will be staying in memory
not being upgraded yet, until player enters particular room.

From upstream 205232af5909e0a257494ff404f36003b004ebc4
2023-03-12 20:58:28 +00:00
Walter Agazzi 89ea094df1 AGS: Engine: fixed idle_anim_speed after restoring old save in updated game
From upstream 0f19fc3d2b9efbc4eb809032bcb7d60b652e1150
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 300379a2d6 AGS: Engine: ScreenOverlay.SetImage() accepts offset as arguments
+ Fixed overlays losing offsets when restoring a save.

From upstream 2002caf32882ab28accd544369c9991675a0dcb1
2023-01-20 14:14:56 +00:00
Hubert Maier 912adcf19b AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:08 +02:00
Thierry Crozat fe80834639 AGS: Store DialogTopics in std::vector
From upstream 2609c0d1ee43a4f997021ce48ca2a4f70ca1a6c7
2022-06-20 23:52:25 +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 5d9ae41cd6 AGS: Store room objects in std::vector
From upstream 5f3b8eb509c9535c75b401f9b7257f7c7acd0e6d
2022-06-15 22:13:02 +01:00
Paul Gilbert c4457ce443 AGS: Changed ComponentHandlers array from being global objects 2022-05-31 18:46:33 -07:00
Paul Gilbert b736c3af77 AGS: Make the ComponentHandlers array static const 2022-05-30 15:23:20 -07:00
Paweł Kołodziejski c4e8320ed4 AGS: Avoid global constructor 2022-05-30 19:42:27 +02:00
Paul Gilbert 1933841f79 AGS: Removed numgui* variables, use size of vectors instead
From upstream 095cf9d77c96fb3a1f9e887d7aaa1ef1e92ebe60
2022-05-10 21:35:19 -07:00
Paul Gilbert 91d25a3098 AGS: Added animation volumes to save format
From upstream 752da45aa7666355e383df0f1017cf5c5842fea1
2022-05-10 21:18:01 -07:00
Paul Gilbert 898650ebbd AGS: Fix WriteOverlays method 2022-05-10 21:17:52 -07: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
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 429d1dcbb4 AGS: Removed hasSerializedBitmap Overlay's member, + added comments
From upstream 67a4c1da9ebcd5626f2fe42a3a9ed42d90994735
2022-05-05 23:17:19 -07:00