Commit Graph

13 Commits

Author SHA1 Message Date
Varun Patil 39ac6aecf0 Fix up build with mruby binding 2018-04-29 18:56:40 +05:30
Jonas Kulla 1a489aafaf Bindings: Fix inconsistency in Viewport dispose (RGSS1)
As noted, on Viewport dispose, RMXP always calls the core
dispose method for child objects regardless of whether
user scripts override it in sub classes.

Implement this behavior in mkxp to prevent infinite recursion.
2014-10-24 18:35:05 +02:00
Jonas Kulla 9758e660c4 Tilemap/VX: Ensure proxy objects don't outlive their parents
Either of these would previously crash (same for VX):

tm = Tilemap.new
at = tm.autotiles
tm = nil
GC.start
at[0] = Bitmap.new(1, 1)

tm = Tilemap.new
at = tm.autotiles
tm.dispose
at[0] = Bitmap.new(1, 1)

Funnily, this makes RMXP itself crash too, but crashing is
never acceptable except for possibly resource exhaustion.
2014-09-26 18:21:50 +02:00
Jonas Kulla e9d0d0566b RGSSError is a subclass of StandardError 2014-09-26 18:20:27 +02:00
Jonas Kulla 9461449cc9 MRuby: Fix handling of Etc/Font properties
Port of f8c26fc515.
2014-09-05 22:53:19 +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 0ab543fd75 MRuby-Binding: Reduce number of object allocations
This is the same change as f067e0eff8,
applied to the mruby backend.
2014-08-09 21:21:38 +02:00
Jonas Kulla ccba946973 util.h: Use size_t for static array sizes 2014-07-19 00:52:00 +02:00
Jonas Kulla 9759e52b3c Exception: Constructor now takes printf style arguments 2013-12-29 18:05:11 +01:00
Jonas Kulla bd63bc9cd2 MRuby-Binding: Make code compile with latest mruby master 2013-12-27 04:36:24 +01:00
Jonas Kulla 0717003114 Use 'snprintf()' instead of the unsafe variant 2013-09-27 19:50:23 +02:00
Jonas Kulla f81e20cc68 Raise exception on too big textures 2013-09-03 15:22:00 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00