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
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
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
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
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
After the updates to cc_instance this should now work
From upstream b1e4f75141ce88b3146f55ecd9d7a95378428072
and 49e8aa0b566dea4ce025f9530a9f2392dbe67a33
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
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
* 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
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