This was done for the IAGSStream in plugin api in the first iteration,
but lost when fixing the api recently.
From upstream e248f320074d8430f14c1c4e513e5fb120e55eb2 and
76b49c0c7a4df46b06aebea86573999f29400809
Detect when a legacy string function (StrCopy, StrCat, StrFormat, etc) modifies
Character's fixed-sized field, and sync that with the new unrestricted property value.
Also fixed check_strcapacity() which incorrectly use new Character field's size instead
of legacy field size after recent changes.
From upstream ad7d19232bf9d69b6060e0cb20585628a6687c9f and
e1a06c5abf2ae0dd55dedc25404f71ef8c4b2fe5
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
Switch function ptr when priority is set, instead of checking for priority during
sorting process.
From upstream ba05c8e055b12849e99a24ffadda960b442d9f75
It turns out our Stream's Seek return value is not defined, and not documented
either. But judging by the other Stream implementations, it was supposed to return
positive whenever there's NO ERROR, regardless of whether the position is matching
user's request.
I suppose we may also make Seek return the resulting position, similar to how some
other libs do (e.g. see SDL and .NET Framework).
From upstream 208fd913225d0732060744fa3b2377a265ad89a3
Renamed HasErrors to GetError.
Require this method to clear any error flags after reading them, so to actually make
this function practical.
From upstream e62e98a6cf6364d5dba5e90dd7b1ef2c96df2ce6
Because _displayspeech() was calling _display_at(), there happen two consecutive
calls to try_auto_play_speech().
If text contains more "&" characters that might lead to an unexpected scripting
error, or even an overriding voice-over.
Instead made _displayspeech() call display_main() directly, and simplified
display_at() to work strictly as a message box starter.
From upstream 1899fad4c4df0e2ddce7eb04699eb262e3638674
I completely forgot that script has Character array where Character struct is an array
element, not Character pointer.
This means that the registered script struct size must match.
Thankfully we already have a mechanism of dealing with these mismatches
internally, it's done by a CCStaticArray. But it must be configured accordingly
To simplify things, picked out CharacterInfoBase as a parent struct to CharacterInfo,
which contains strictly the original fields. Will use sizeof(CharacterInfoBase) when
setting up StaticCharacterArray.
From upstream 4be15565755bc54f5d8f48be0e6aebc6eee117c1
This writes a file offset at which extension blocks are found into one of the reserved
ints inside main game data block.
If this information is present, the engine will also preread game name and save
folder name from "v361_objnames" block. This will ensure that game name and save
folder info is correct when setting up config, as well as reporting game properties on
"--tell-gameproperties" command.
From upstream 8bf311956edf483030a2ec71c315282751a1de29
Extension "v361_objnames" contains scriptnames and descriptions for name
fields that had fixed length in legacy format:
- Character script name and name;
- InventoryItem name;
- Mouse cursor's script name;
- Audioclip's script name and filename.
From upstream b7024c0c284d65a6cb1b7a0a8594409a0e1cd3b9
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
NOTE: we still read the old fields from game data, avoid changing the
data format in the middle (in the sake of both backward and forward compatibility).
These fixed-sized values are assigned to the clip properties first.
For unrestricted values we'll have to add a data extension, appended to the end of data format.
From upstream 0aa62d14cadcb77dfcf1351a962969069c5d1796
NOTE: we still read the old script name field from game data, avoid changing
the data format in the middle (in the sake of both backward and forward compatibility).
These fixed-sized value is assigned to the item properties first.
For unrestricted value we'll have to add a data extension, appended to the end of data format.
From upstream cda044466a5a79d61f7b536d0b4e17f073d9bfd9
NOTE: we still read the old name field from game data, avoid changing
the data format in the middle (in the sake of both backward and forward
compatibility). These fixed-sized value is assigned to the item properties
first. For unrestricted value we'll have to add a data extension,
appended to the end of data format.
From upstream 3d700e3c488945945affe51924047efb9561c8d0
NOTE 1: we *must* keep the old fixed-sized fields for the time being,
for compaibility with the plugin API. Would the plugin API be adjusted
and have direct access to a character data struct removed, then these
fields may be removed as well.
NOTE 2: we still read these old fields from game data, avoid changing the
data format in the middle (in the sake of both backward and forward
compatibility). These fixed-sized values are assigned to the character
properties first. For unrestricted values we'll have to add a data extension,
appended to the end of data format.
From upstream b02814b8bb3bb7a2cd00110466e2bd3047e772d1
Split BitmapToVideoMemImpl into simpler BitmapToVideoMemImpl and
BitmapToVideoMemLinearImpl meant for that "linear filter" transparency fix.
This does not seem to make things noticeably faster with non-linear scaling,
but may make it easier to understand the code.
Also in case we'd like to remove/replace this hack someday.
From upstream 5c2129b8f176e8d95b0f26132bf1749d7dabdc29
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
AlignedStream was used initially in attempt to automate reading legacy formats,
where structs were dumped from memory into filestream directly,
resulting in alignment padding inserted into the file format.
While using AlignedStream made working with old formats easier, this approach also has certain problems:
1. This makes extra padding in file formats implicit and non-obvious.
2. Object Read/Write functions will depend on the type of the passed stream.
3. Adding anything into Read/Write functions will also be affected by AlignedStream,
and in theory may lead to additional unnecessary padding inserted simply by keeping same serialization logic.
4. AlignedStream does not support Seek, and in general you cannot trivially skip parts of struct by skipping
or reading N bytes, you'll have to read it out step by step to keep alignment calculation working.
These concerns made me make the decision to remove AlignedStream, and restore hardcoded padding instead.
It's explicit and honest.
From upstream ffc59e82029bed4da9dd595dac015374681fd2e4
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
Handling alpha channel is meaningless in BitmapToVideoMemOpaque(),
because the whole point of this function is to produce fully opaque texture.
Alpha + opaque combination had never been a case in practice.
From upstream ead7d5974bce25d507134ec98e8c055039d00e41