We didn't account for the spec dictating that
scissor test does affect FBO blit operations,
which resulted in corrupted output if more than
one viewport with an active effect (tone, color)
was created.
The reason I never caught this before must be
that the fglrx-legacy driver is actually bugged
in this aspect and ignores the scissor on blit.
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.
With this we now link to libvorbis/ogg directly.
When this is enabled, one can theoretically also
build SDL_sound without ogg support, although I
doubt it makes much of a difference.
Adittionally, count frames instead of samples
for playback offset calculation.
We will not be using librubberband for in place
pitch shifting. RMXP "shifts" PCM based audio
by just playing it back slower/faster, which
OpenAL takes care of for us. A native midi backend
will be able to effortlessly pitch shift by
multiplying note pitches, should we ever get one.
I have been chasing this ghost for way too long.
Making this an option makes no sense. It ought to
be the default behavior, as RMXP pitch shifts PCM
based audio files the exact same way.
This reverts commit ac35d4214e.
This is a major change in the Audio module that comes with
many changes throughout the codebase and dependency list.
The main gist is that we're finally nuking the last pieces
of SFML from the project. sfml-audio brought with itself
unneeded and big dependencies (libsndfile, libvorbisenc)
while at the same time limiting the amount of audio formats
mkxp can support (eg. we now get mp3 for free, and wma/midi
can be implemented by extending SDL_sound directly).
The increased control gained by interfacing with OpenAL directly
will also allow for easy integration of a dedicated audio
stretcher (librubberband), as well as enable us to implement
looped ogg vorbis (via the 'LOOPSTART'/'LOOPLENGTH' tags),
as required by RGSS2, in the future.
The FileSystem class has had its SFML parts removed.
Aditionally, audio file extensions to be supplemented are
now automatically detected based on how SDL_sound was
built (ie. if no mp3 support was built, mkxp won't try
to look for *.mp3 files). The final used extension
can be optionally returned by 'openRead' calls so
SDL_sound and SDL2_image can immediately choose the
right decoder.
The OpenAL context is created and destroyed in main.cpp
along side the GL context.
Finally got around to nuking that ugly pile of shit that was
previously there for PhysFS file enumeration because filepath
cache generation with unencrypted game files + archive + RTP
has started taking around 6 seconds. Thank $DEITY.
This replaces the previously directly bound #clone
methods, which weren't really the "the Ruby way".
Rubys default Object#clone will call into our #init_copy
methods instead.
Partly incorporates pull request #3 by /cremno.
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.
We now actively track how far behind / in front of an
ideal timestep we are during each frame, and try to
catch up / delay approximate this timing.
Therefore we use more precise timers and sleep functions
(nanosleep if available). We also delay **before** the
final buffer swap so the frame displays at more consistent
points in time.
Not only should this provide a somewhat more consistent
looking map scrolling at lower frame rates, it also
guarantees that we don't fall out of sync eg. with the
Audio during longer cutscenes.
'Graphics.frameReset()' now finally has a function, in
that it resets the ideal timestep approximation, which I
beliefe was also its job in the original RMXP engine.
I'm not sure how well this will work when the frame rate
is set to the monitor refresh rate and vsync is turned on.
Very likely unnecessary frame skips will occur here and there
due to imprecise timers. In the future we should probably
check if the frame rate is equal to or higher than the
monitor rate, and disable frame skip accordingly.
These changes currently break the F2 FPS display (it shows
a value that's slightly too high).
Releasing a Tilemap atlas into the pool on every map switch
will blow out tons of smaller textures for very little gain,
as atlas textures are already pretty much impossible to
recycle anywhere but in new Tilemaps.
We override 'Marshal::load()' via alias and call it with
a custom auxiliary proc in the alias which sets the encoding
of all demarshalled strings to UTF-8. The case where a user
himself provided a proc to 'load()' is not implemented.
This is definitely a better solution than patching the ruby
source tree. Thanks to github.com/cremno for hints and help!