Commit Graph

10 Commits

Author SHA1 Message Date
Jonas Kulla c9d5059238 Pass value object attributes by reference (instead of pointer)
This underlines that no reference inside the setter is taken,
and that these attributes are non-nullable.

Also removes a couple of superfluous attribute macros.
2014-10-25 23:33:41 +02:00
Jonas Kulla 0131ed09f0 Bindings: Remove 'wrapNilProperty'
It's completely useless lol.
2014-09-05 01:59:01 +02:00
Jonas Kulla f8c26fc515 Core/MRI: Fix handling of Etc/Font properties
The gist of it is that for Etc and Font props, the assignment
operator (eg. 'sprite.color=') does not take a reference of the
right hand parameter and replaces its previous one with it (this
was the old behavior). Rather, it keeps its internal property
object and copies the parameter object into it by value.
The getter is unchanged; it still returns a reference to the
internal property object.

s = Sprite.new
c = Color.new
s.color = c
p s.color == c # => true
p s.color.object_id == c.object_id # => false (true before)
c = s.color
p s.color.object_id == c.object_id # => true
2014-09-05 01:58:41 +02:00
cremno 173ee07959 get rid of INIT_TYPE() / initType()
A function to initialize rb_data_type_t variables is not needed.

Also fix a FIXME (WindowVX's name is now "Window") on the way.
2014-08-29 21:01:53 +02:00
Jonas Kulla 55f1542c76 Merge separate RGSS version build configs into one
Setup active RGSS version at runtime. Desired version can be
specified via config, or as default, auto detected from the game
files. This removes the need to build specifically for each
version, which should help packaging a lot.

This also greatly reduces the danger of introducing code that
wouldn't compile on all RGSS version paths (as certain code paths
were completely ifdef'd out).

This can be optimized more, eg. not compiling shaders that aren't
needed in the active version.
2014-08-28 23:22:05 +02:00
Jonas Kulla e858bbdcf5 Lift 'Disposable' concept from core into bindings
Instead of replicating the RGSS Disposable interface in C++
and merely binding it, redefine the 'disposed' state as the
entire core object being deleted (and the binding object's
private pointer being null).

This makes the behavior more accurate in regard to RMXP.
It is now for example possible to subclass disposable classes
and access their 'dispose'/'disposed?' methods without
initializing the base class first (because the internal pointer
is simply null before initialization). Accessing any other
base methods will still raise an exception.

There are some quirks and irregular behavior in RMXP; eg.
most nullable bitmap attributes of disposable classes
(Sprite, Plane etc.) can still be queried afterwards, but
some cannot (Tilemap#tileset), and disposing certain
attributes crashes RMXP entirely (Tilemap#autotiles[n]).
mkxp tries to behave as close possible, but will be more
lenient some circumstances.

To the core, disposed bitmap attributes will look
identically to null, which slightly diverges from RMXP
(where they're treated as still existing, but aren't drawn).
The Disposable interface has been retained containing a
single signal, for the binding to inform core when
objects are disposed (so active attributes can be set to null).
2014-08-09 21:21:38 +02:00
Jonas Kulla a541cb1205 Some RGSS2/RGSS3 compile fixes 2014-07-13 05:34:18 +02:00
Jonas Kulla af9039f58d Sprite: Implement wave effect (RGSS2)
This initial implementation emulates the way RMVX splits
the sprite into "chunks" of about 8 pixels, which it then
scrolls left/right on a vertical sine wave. It even
replicates the weird behavior when wave_amp < 0, namely
"shrinking" the src_rect horizontally.

As with bush_opacity, this effect in combination with
rotation will render differently from RMVX.
2014-02-03 15:32:50 +01:00
Jonas Kulla f067e0eff8 MRI-Binding: Reduce number of object allocations
Previously, wrapped instances of mkxp core classes were
stored as RData ivars inside the actual object. This turned
out to be pointless as RData objects themselves are perfectly
valid objects that can carry ivars and have parent classes.
Therefore, the RData objects are now exposed directly to
the user scripts, effectively halving the amount of object
allocations.
2013-10-30 10:06:24 +01:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00