Commit Graph
89 Commits
Author SHA1 Message Date
Walter Agazzi 6a2d740403 AGS: Engine: fix setting Viewport and Camera sizes in game_start
1. Fixed primary viewport and camera created with zero sizes, because they are initialized before the game resolution.
2. Fixed camera's size set in "game_start" function is clamped against a room placeholder size of 320x200.
From upstream ff615af2f5c8d0ee21e6ad633930352c2621883f
2024-10-30 18:07:42 +02:00
Walter Agazzi 91ea7cb099 AGS: Don't attempt to access endtimeoffs/frame vectors for lines with no phonemes 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 33697a821a AGS: FIx missing line setting coldepth
Completes upstream 575877a6c89da5f4299f0fc78ff0291b0bb1894a
2024-10-30 18:07:42 +02:00
Walter Agazzi 47b1ac9edc AGS: Engine: fixed CharacterInfo export to script, after adding new fields
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
2024-10-30 18:07:42 +02:00
Walter Agazzi bdb34c01cc AGS: Engine: unrestricted scriptname and name in CharacterInfo
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
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 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 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 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 bd1bf59315 AGS: Common: hide GUIObject's size behind the get/set methods
From upstream ca442e0f9259d74a2bc6ccd7d28e59381ac1b9d1
2024-10-30 18:07:42 +02:00
Walter Agazzi 0bb33fcfc5 AGS: Engine: made sure game res inited in InitGameState()
This is more logical than calling this from "engine_setup",
 and also fixes running another AGS game from current game after commit 5596736 .
From upstream a82d8147d4424b0aa83762d810db96cff31d7af9
2024-10-30 18:07:42 +02:00
Walter Agazzi 0f5d6a1f5e AGS: Engine: store plugin infos in std::vector
Partially from upstream 32fb3fbe2d7186fafcf948dba92b5347b12cb7ee
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 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 3a5ccd4cba AGS: Engine: moved dynamic object management functions to a separate unit
From upstream 1a9df937e3ac9eba0c2f5b663507a52569d635e0
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
Walter Agazzi 947acb21ec AGS: Engine: fixed improper cleanup of scrGUI array in unload_game_file()
From upstream 045b4a6ed1e09a2d563ee5ad0addf601f700173d
2023-09-02 14:02:52 +02:00
Walter Agazzi 1bf6a2025f AGS: Engine: improvements to the "timeout" check
* Fixed _lastAliveTs was not reset right after calling sys_evt_process_pending();
this caused events polling called continuously after timeout happened once.
* Set timeout to 60 fps (16.777 ms) instead of random 10ms.
* Do the timeout test only each 1000th loop iteration.
* Few other tiny adjustments in code.

Partially from upstream 60aaef003021fec2f75d4dc6db1b24f0b5d2be65
2023-05-14 23:04:38 +02:00
Thierry Crozat 08db4be24c AGS: As a hotfix, restored the old way to test for hung script loops
The timeout method introduced by 6f665dfe is not working very well and
gives "false positives", so I'll disable it for the time being.

From upstream e0edb28b6606c360a1ea3fdcc487c2b05929ed02
2022-06-23 23:57:49 +01:00
Thierry Crozat 6f665dfe68 AGS: Test for hanging script using timeout instead of while loops
From upstream c34f0c96596f1a7814c15e7a06c2c498cb95ebfc
2022-06-23 23:57:27 +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 1933841f79 AGS: Removed numgui* variables, use size of vectors instead
From upstream 095cf9d77c96fb3a1f9e887d7aaa1ef1e92ebe60
2022-05-10 21:35:19 -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 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 6ef504bba2 AGS: Store gui draw order in a std::vector
From upstream fcc873ef0c26439faf67100f4d70d540434ca9f5
2022-05-01 17:23:22 -07:00
Paul Gilbert d2b03800c6 AGS: Allow to place sounds on a crossfade channels for compatibility
From upstream 86564e983572b4ffb3cd12b00c116ae91c6fcbe4
2022-04-29 22:20:39 -07:00
Paul Gilbert 043f80a237 AGS: Avoid using global "game" in game_init because it's possible
From upstream 4041a18e7c1744aa59773da19de40b51bdc78a49
2022-04-24 16:00:05 -07:00
Paul Gilbert 9533c0e028 AGS: Made script module index an unsigned value
From upstream bd4e65677eb0319ff746e519ee40016000a4f4f9
2022-04-24 16:00:04 -07:00
Paul Gilbert 09da0fbf5d AGS: Implemented dialog_options_text_input(int chr) callback
From upstream 76db49c6189810faa467b00c1aef9e78c526876d
2022-04-18 19:10:39 -07:00
Paul Gilbert 84a54f5e8e AGS: Remade OPT_FONTLOADLOGIC into individual font's flags
From upstream 54c5303c5e0ed98609397d9e5df4114f128fb4a2
2022-03-27 13:37:14 -07:00
Paul Gilbert 0211fa25e6 AGS: Moved linespacing precalc to post_init_font()
From upstream f848107265d2662819636790d24c13292fe2ec82
2022-03-23 20:17:33 -07:00
Paul Gilbert ca4c91031b AGS: Configurable font init mode, for backward compatibility
From upstream 9a11a1d4334aef99b8b516a13d5a5bcc0284fde7
2022-03-23 20:09:46 -07:00
Paul Gilbert d42b639142 AGS: Always precalculate and save font linespacing (as outlined)
From upstream 8ba3a77e38a6dc8ace6d6393042730d73292a1a7
2022-03-22 22:30:14 -07:00
Paul Gilbert dc3ce9f70a AGS: Renamed few font functions for consistent naming style
From upstream 9c355da410b734edc79212009a5e1be0b502c3b0
2022-03-22 22:30:13 -07:00
Paul Gilbert a3dda03cf1 AGS: Store Views in std::vector
From upstream 095db88ae0f1acceb298f793a2e1b81dbe06fcff
2022-03-18 21:29:56 -07:00
Paul Gilbert ee311d660f AGS: Make game audiochannels limit defined by a game version
From upstream 65f0b843dfd85967135eca1bda46976aa1ddcf26
2022-03-17 21:49:25 -07:00
Paul Gilbert 3167bac67b AGS: More clear use of the "max channels" constants
From upstream 2fd582a2a5fc9d38643277903854a977f8995e07
2022-03-17 21:49:25 -07:00
Paul Gilbert 4293a267cb AGS: Corrected font outline upgrade condition
From upstream 070b3ff3d0040f65ef42764033cf0d01742926ff
2022-03-17 21:49:24 -07:00
Paul Gilbert 448bb2d77e AGS: Moved "LucasFan" font hack to game_init, enable for all systems
From upstream 5d84ea958f9d2ba5582e69f211dbcb006ed4e187
2022-03-14 21:46:58 -07:00
Paul Gilbert 255a739eca AGS: Encapsulate game object draw caches in draw.cpp
From upstream e04ebc0039580faf017ceb0acbeeab975bf44fcc
2022-03-14 21:04:09 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00