Changes CallFunction and CallFunctionVoid to use a HandleValue as object
parameter. Also changes some JS serialization/deserialization functions
to only support the JSAPI rooted types (drop support for CScriptVal and
CScriptValRooted there). Some other functions got changed too because
they were closely related.
Refs #2415
Refs #2462
This was SVN commit r15592.
* CGameLoader created a new JS::Value when assigning to m_Metadata.
This means it didn't actually update metadata in SavedGames::Load. The
new approach solves this problem and should work well if
CScriptValRooted gets replaced in the future.
* The cloning in ScriptFunctions.cpp was required. Removing it caused
compartment mismatches.
* Now CGameLoader loads the metadata unconditinally because we didn't
actually use the option to not load load it.
Ref #2415
This was SVN commit r15589.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.
Refs #2415
Refs #2462
This was SVN commit r15568.
* Adds additional overloads/specializations which are required when
passing JS::Handle<T>/JS::MutableHandle<T> types to different functions.
* Replaces GetPropertyJS with a GetProperty specialization.
* Allows us to avoid the implementation of ToJSVal specializations for
JS::Value and JS::HandleValue. Such conversions should only happen if
there's no way around it and if you are aware of it.
* Adds test to make sure that all potentially required specializations
with custom implementations are instantiated. This should help prevent
introducing bugs in temporarily unused code.
Refs #2415
This was SVN commit r15567.
I still experience troubles with serialization tests but I played a few
games without OOS. At least these changes will help us to debug more
efficiently the remaining problems.
Fixes initialization of visibility data and update order for LoS-related
systems (territory borders, etc).
Also removes a C-like array and fixes a player ID shifting.
Refs #599
This was SVN commit r15563.
Rooting works different now and the CScriptVal types are going to be
removed. We will need rooting tests again, but they will have to work
completely different than this test implementation.
Refs #2415
This was SVN commit r15562.
Also includes one little "demo-usecase", but additional code will be
changed to use that in future commits.
Refs #2415
Refs #2462
This was SVN commit r15542.
Changes the CallFunction implementation to use macros because otherwise
we'd have to write twice as many functions manually.
Adapts GetSavedGameData to use the new function template. Additional
callers will be changed in future commits.
Refs #2415
Refs #2462
This was SVN commit r15541.
JS::MutableHandleValue is similar to JS::HandleValue, but the whole
JS::Value it points to can be replaced.
This change is needed for support of exact stack rooting and moving GC.
Contains a few other trivial API adjustments and style improvements too.
Refs #2462
Refs #2415
This was SVN commit r15534.
In v24 you called JS_InitClass and passed in a definition of JSNative
functions. Later you could call JS_NewObject with this class and the
object would get a prototype with the specified JSNative functions.
In ESR31 you now have to explicitly store the prototype object returned
by JS_InitClass and pass it as prototype argument to JS_NewObject to
achieve the same.
This change modifies our existing ScriptInterface implementation for
custom object types a bit and uses it at places where the JSAPI was used
directly before.
Refs #2462
This was SVN commit r15524.
JS::HandleValue is basically a wrapper around a JS::Value that is safe
for exact stack rooting and moving GC.
I've tried to keep this changeset rather small and isolated and
therefore create additional JS::Rooted<T> values at some places where
the function should eventually directly take a JS::Handle<T>.
The functions "CallFunction" and "CallFunctionVoid" put their arguments
inside a JS::AutoValueVector because this will be passed directly to
"CallFunction_" with ESR31.
Refs #2462
Refs #2415
This was SVN commit r15517.
This is the new way for working with arguments in JSNative functions.
JS_THIS_VALUE, JS_ARGV, JS_SET_RVAL and direct access to vp or argc are
deprecated and will probably be removed in future versions of
SpiderMonkey.
CallArgs also takes care of proper rooting and you can get the values as
Handles or MutableHandles. The interface changes a little bit for ESR
31, but commiting this now still makes it easier and the changes shout
be straigtforward (search and replace more or less).
Refs #2462
Refs #2415
This was SVN commit r15516.
Print an error to the console and return the original (untranslated)
string instead of triggering an assertion in debug builds or a crash and
memory corruption in release builds.
Works around a crash on the history screen. Why the plural form is
missing is another topic and will have to be solved separately.
This was SVN commit r15493.
Do some intersection tests on the CPU so that the silhouette render
passes only have to draw models/patches that might actually contribute
to silhouettes, saving the CPU and GPU cost of rendering more objects
than necessary.
This was SVN commit r15483.
Remove commented out code writing triggers that has nothing to do with
the actual triggers implementation.
Free memory that was allocated for error reporting when when fork()
fails.
Remove dead initialization.
This was SVN commit r15477.
Change the shader itself so that the effects look nicer and are more
consistent across settings.
Rework the water mesh generation (simpler system). Fix a few issues.
May work oddly with Atlas since I haven't been able to compile yet.
Refs #1875 (maybe fix), Fixes#2077 (I'll assume it does), Fixes#2114
(assumption again), refs #48.
This was SVN commit r15473.
Fix a long-standing typo in TerrainRenderer for water rendering that
apparently had no effect.
Don't compress the water textures to make it look better. They will be
changed anyhow.
This was SVN commit r15461.
Previously we had a single culling frustum based on the main camera, and
any object outside the frustum would never get rendered, even if it
should actually contribute to shadows or reflections/refractions. This
caused ugly pop-in effects in the shadows and reflections while
scrolling.
Extend the renderer to support multiple cull groups, each with a
separate frustum and with separate lists of submitted objects, so that
shadows and reflections will render the correctly culled sets of
objects.
Update the shadow map generation to compute the (hopefully) correct
bounds and matrices for this new scheme.
Include terrain patches in the shadow bounds, so hills can cast shadows
correctly.
Remove the code that tried to render objects slightly outside the camera
frustum in order to reduce the pop-in effect, since that was a
workaround for the lack of a proper fix.
Remove the model/patch filtering code, which was used to cull objects
that were in the normal camera frustum but should be excluded from
reflections/refractions, since that's redundant now too.
Inline DistanceToPlane to save a few hundred usecs per frame inside
CCmpUnitRenderer::RenderSubmit.
Fixes#504, #579.
This was SVN commit r15445.
Allow components to individually subscribe/unsubscribe to messages,
instead of statically subscribing the entire component type. Use this
for most Interpolate/RenderSubmit messages, to avoid the performance
cost of passing those messages to a large number of components that will
just ignore them anyway.
On Azure Coast this reduces total time per frame by about 30% on a
CPU-bound system.
This was SVN commit r15400.
Adds converted Relax NG XML grammars for each (Note: don't edit these
directly, modify the compact syntax .rnc files instead, then use a
conversion tool http://relaxng.org/#conversion to generate the .rng
files).
Adds Perl script to validate the XML files using the new grammars
This was SVN commit r15377.
Once 'delete' is called on an object, that object no longer exists, and
accessing its member variables is undefined behaviour. GCC 4.9's
optimiser recognises this, and eliminates any writes to member variables
inside the destructor, since it knows they cannot legally be read later.
BoundaryTagManager relied on ~FreedBlock resetting its memory to 0, so
this optimisation broke it. Replace the placement new/delete with plain
non-magic Setup/Reset functions, to avoid the optimisation.
Fixes#2481.
This was SVN commit r15334.
This way we do not have two error messages when starting Atlas, but the
dynamic Atlas lib is not available.
Patch by Gallaecio. Fixes#1540.
This was SVN commit r15301.
Does not account for setting rally points on units that can move into
the FoW/SoD.
Recalculates paths even if the rally points are not displayed.
Refactors UpdateMarkers() to remove some indentation levels.
Based on patch by Itms. Fixes#1257.
This was SVN commit r15288.
I guess changes to the map loading sequence caused the TerrainChanged
message to be sent before the map was switched from square to circular
instead of after. The pathfinder didn't notice the switch, so it
continued treating the map as if it were square, allowing units to walk
into the permanent map-corner SOD and vanish, and allowing territories
to expand into the SOD.
Tell the pathfinder explicitly when the map shape changes, so it can
discard its cached data correctly.
This was SVN commit r15277.
Fixes potential infinite loop if worker thread was running but not
enabled.
Fixes apparent bug in fading sound smoothness.
Cleans up worker class slightly.
Cleans up weird and inconsistent whitespace.
This was SVN commit r15269.
Instead of each CCmpVisualActor rendering itself individually, collect
all the units in a single CCmpUnitRenderer. This avoids the overhead of
doing Interpolate/RenderSubmit calls every frame for every object in the
world. It also allows more efficient culling.
CCmpUnitRenderer knows the positions of each object at the start and end
of each turn, and computes the bounding sphere of the object along that
path. That allows quick culling without recomputing the precise
interpolated transform every frame. (In the future it could be improved
much more.)
Clarify and clean up the sending of PositionChanged messages, and add
new InterpolatedPositionChanged.
Remove the forceFloating parameter from GetInterpolatedTransform, since
it doesn't fit the new design. Replace it with a (non-synchronised) flag
in CCmpPosition.
Move construction progress from CCmpVisualActor to CCmpPosition, so that
it consistently affects all position/transform computation.
Refs #2337.
This was SVN commit r15265.
Deserialize SYSTEM_ENTITY before any other entities. This makes it safe
for Deserialize() methods to access system components (mirroring how
Init() can already access system components).
Add a Deserialized message, sent after all entities have been
deserialized, to help with some other sequencing problems.
This was SVN commit r15264.
This allows component Init functions to make use of the terrain
immediately, instead of delaying some computations until the first
frame.
This was SVN commit r15262.
BoundingSphere is similar to a bounding box, but more spherical.
SOverlaySphere is useful for visualising BoundingSphere (it's quite
inefficient and should only be used for debug functionality).
Normalise the camera frustum clipping planes, so that IsSphereVisible
gives the correct result.
This was SVN commit r15261.