Commit Graph

18 Commits

Author SHA1 Message Date
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 b1981055e1 Core: Remove ifdefs that don't influence RGSS specific behavior
This is the first step in eliminating the build time RGSS
versioning.
2014-08-28 19:43:13 +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 6bbdf7e183 Bitmap#blt: Clamp source rect to source bitmap bounds
RGSS allows the source rectangle in both `blt` and
`stretch_blt` to lie outside the source bitmap bounds
(treating the missing data as (0, 0, 0, 0)) and to be
inverted (in which case the blitted image is also inverted).

This commit only hanldes a corner case that
arises in the game "Last Scenario"; emulating the full
RGSS behavior is however desirable.
2014-07-09 03:06:43 +02:00
Jonas Kulla 58d86039d5 Merge branch 'dev' 2014-04-17 08:19:24 +02:00
Jonas Kulla 51c5ca1410 Graphics: Taint entire Bitmap in #snap_to_bitmap 2014-04-15 19:05:36 +02:00
Jonas Kulla e0a4dfe372 Bitmap: Make #get_pixel/#set_pixel more accurate
This gets rid of the "batch/flush" semantics for #set_pixel
and instead just directly uploads the pixel color to the
texture, circumventing the float conversion entirely.
Also makes a lot of code simpler in many places as calling
'flush()' is no longer required for bitmaps.
2014-01-31 10:19:16 +01:00
Jonas Kulla ef2430e0c3 Sanitize #include statements
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.

The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
2013-12-04 17:48:37 +01:00
Jonas Kulla 52dd1dbe2f Bitmap: Add warning to 'flush()' 2013-10-17 15:28:43 +02:00
Jonas Kulla d8dab9c429 Start ifdef'ing out RGSS2 functionality 2013-10-02 22:40:09 +02:00
Jonas Kulla a54acce6b7 Implement Bitmap 'blur'
I was a bit confused at first because I thought Enterbrain
had actually implemented a full Gaussian blur, but nope,
just dumb averaging.
2013-10-01 18:12:52 +02:00
Jonas Kulla 9f26ff9fb0 Port over Bitmap 'radial_blur' from old SFML codebase
This implementation is also heaps better than the old
one as it doesn't use a (differently sized) aux texture,
meaning the Bitmap discards its old texture and aquires
one of same size, making reuse through the TexPool a
lot more likely. It also saves on the aux texture blits
and binding switches.

As the setup / resource acquisition far outweighs the
actual rendering cost, operation time is relatively
constant no matter how many divisions are used.
2013-10-01 12:03:20 +02:00
Jonas Kulla dff2d79a70 Implement blits from mega surfaces to regular Bitmaps
This is used in events that take their sprite from a tile
out of the tileset.
2013-09-25 17:07:43 +02:00
Jonas Kulla 10ec55e39b Implement a new tileset atlas layout to allow for bigger tilesets
The atlas packing algorithm has been reworked to pack autotiles
and tileset very efficiently into a texture, splitting the tileset
in multiple ways and eliminating the previous duplication of image
data in the atlas across "frames". Animation, which these frames
were designed for, is now done via duplicated buffer frames,
ie. each animation frame has its own VBO and IBO data. This was
not done to save on VRAM (hardly less memory is used), but to
make place for the new atlas layout.
Thanks to this new layout, even with a max texture size of 2048,
one can use tilesets with up to 15000 height. Of course, such
a tileset couldn't be stored in a regular Bitmap to begin with,
which is why I also introduced a hack called "mega surfaces":
software surfaces stored in RAM and wrapped inside a Bitmap,
whose sole purpose is to be passed to a Tilemap as tilesets.

Various other minor changes and fixes are included.
2013-09-24 19:35:38 +02:00
Jonas Kulla 9e63fb6b64 Remove the remaining bits of deprecated GL usage
The drawing is now completely shader based, which makes away
with all usage of the depracted matrix stack. This also allows
us to do things like simple translations and texture coordinate
translation directly instead of doing everything indirectly
through matrices.

Fixed vertex attributes ('vertexPointer()' etc) are also
replaced with user defined attribute arrays.
2013-09-23 07:50:22 +02:00
Jonas Kulla b151a22f6e Rename 'Tex' to 'TEX' for consistency 2013-09-06 12:26:41 +02:00
Jonas Kulla 31c007b541 Mark internal methods 2013-09-03 15:21:44 +02:00
Jonas Kulla ff25887f41 Initial commit 2013-09-01 16:27:21 +02:00