Commit Graph
33 Commits
Author SHA1 Message Date
Le Philousophe 55fe1525ac AGS: Fix int vs int32 discrepancies 2024-10-31 08:53:43 +01:00
Walter Agazzi 794318b9db AGS: Common: fixed item crosshair colors read with mistake
From upstream 4de9f8b1064823130945d780e7ec16104c678e00
2024-10-30 18:07:42 +02:00
Walter Agazzi 97e847ff50 AGS: Engine: replaced ReadByte with ReadInt8 where makes sense
ReadByte has special behavior for return value in case of EOF, and in case of
reading data fields it's more clear to indicate an integer of particular size.
From upstream 47a21109c4ef35226fbc89f06c8527db6eaad480
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 96db95c255 AGS: Engine: fix some minor warnings
From upstream 28693377db7ae242782b313717ec9c476ecaff0f
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 bfed6e06e5 AGS: Engine: separate CharacterInfo read/write for saves, no padding
From upstream c9d48a1c8da3dbcc49d483973b8a478925ea195a
2024-10-30 18:07:42 +02:00
Walter Agazzi 47c095545b AGS: Common: don't use AlignedStream, hardcode padding in read/write funcs
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
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 101e5ae147 AGS: Common: store WordDictionary in std::unique_ptr
from upstream e084b20cafec94d91b347300dbc281a4a9fb19aa
2024-10-30 18:07:42 +02:00
Walter Agazzi 1ca1fe14c0 AGS: Common: store CharacterInfos in std::vector
from upstream f4fe44fe3b51670db2a8a93c450ffa09c8b63e38
2024-10-30 18:07:42 +02:00
Walter Agazzi 15c6da02ca AGS: Engine: don't do the stupid pointer reassignment when loading a save
From upstream e1672eb56d6ba03d116e1b62570717884c54a01f
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 f09519834c AGS: Engine: updated unload_game_file(), fix few things not reset
This is not as important in case of game quit, as it is in case of RunAGSGame().

* Adjusted order of data release in unload_game_file() to be in sync with 3.6.1 (as much as possible).
* Fixed GameSetupStruct not releasing some of the data in Free().

Noteably this fixes font infos to not getting fully reset on RunAGSGame().
from upstream 1cc9d22095d0ee90541ce506fa54c538de7ca4ad
2024-03-28 12:03:33 +01:00
Walter Agazzi 4eaac90e4e AGS: Common: safer reading of fixed-len string fields
From upstream 458a524a418f30142f5fe2e512902b7e00e97eec
2024-01-17 03:12:30 +01: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 17cbbe1252 AGS: Engine: fixed idle anim speed always set in backwards compat mode
Was broken by 0f19fc3
From upstream 899b6be0ea088737799e075e7906bc3308108699
2023-04-29 13:11:41 +02: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 5ad85c6b42 AGS: Common: replaced GameSetupStruct::messages with an array of Strings
This also fixes an allocation/deallocation mismatch found in the code.
From upstream b47a086cbd589cd271c5fe1b3497f9b8e4ae4abf
2023-03-12 20:58:27 +00:00
Thierry Crozat 9e940e4360 AGS: Put more unused code under OBSOLETE
From upstream 0d129c9cf854fe12e277fe6b52a8dca076a51ad8
2022-06-19 20:50:24 +01:00
Thierry Crozat e90fb00412 AGS: Replaced more strcpy with snprintf, for safety
From upstream 1b6cf053ebbe85e7ba6c5828e2582d757503bc16
2022-06-19 20:50:24 +01:00
Paul Gilbert b1649597d7 AGS: Replaced Math/std Min/Max with ScummVM macros
Inspired by 6dee5ee6f271c600e30879d892295ea6069e8cc9
2022-05-05 22:41:10 -07:00
Paul Gilbert f2399dc15c AGS: Fixing various "unused variable/arg" warnings
From upstream 4b3c27c1a2b39d6c6b089adee111c6889d19ad0e
2022-04-25 19:17:26 -07:00
Paul Gilbert 9dd7ce9313 AGS: Store debug room names in std::vector
From upstream 83499b1afbb1a4c0717cf9b665969f4e4ca9b6b1
2022-04-23 19:36:22 -07:00
Paul Gilbert 4ecb2115ca AGS: Remove cursor limit
From upstream 612f5702ce7cdee0acb898705a0ae11c84651afb
2022-04-12 22:27:55 -07:00
Paul Gilbert 1dd1946aff AGS: Attempt to clarify meaning of the Font's import size
From upstream 71adfaa57e83b36315fc36feddaa72dd46dd11c5
2022-04-12 22:27:53 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Cameron Cawley 9b348b3e7d AGS: Fix more type mismatches 2021-06-16 13:03:41 +01:00
Paul Gilbert 4a8ad2d199 AGS: Fix Buildbot compiler warning 2021-06-15 18:35:38 -07:00
D G Turner efc9e04ce0 AGS: Fix Various GCC Compiler Warnings 2021-06-15 11:07:23 +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