Fix issue where outlines would get cropped when crossing the glyph
texture boundary.
This is accomplished by adding 4 border pixels to each glyph texture.
The `--save-folder` command line option, or `save-folder` option in
.xsys4rc, can be used to override the default save folder location.
This is useful in cases where English and Japanese versions of the same
game share a save location, or to isolate saves from a mod, etc.
SDL_ttf isn't really designed to be used with OpenGL. It caches glyph
bitmaps in memory, whereas we want to cache glyph textures on the GPU.
By using FreeType directly we avoid creating and destroying a new
texture every time a glyph is rendered.
Additionally, all glyph textures (including fnl-derived glyphs) now use
the GL_RED internal format instead of GL_RGBA.
Values returned by SACT2.System_GetDate etc. should correspond to the
Windows SYSTEMTIME structure, not struct tm.
This also fixes a bug where get_time() returns a value greater than 60
for `sec`.
Use `unlikely` (__builtin_expect) to help the compiler optimize error
checks in some hot functions (in my testing, stack_pop_var was one of
the hottest functions, right behind execute_instruction).
Part of StoatSpriteEngine and KiwiSoundEngine.
This fixes an issue with per-channel volume settings not working
correctly in Haruurare (and presumably other games).
Used in Sengoku Rance (when Ran summons Suzaku).
The scale curve in this implementation is a bit off compared to
AliceSoft's implementation (theirs looks a bit sharper at the end), but
it's only really noticable with a very long effect time.
AliceSoft's implementation also has a lot more jitter, but I don't think
this is intentional.
The reported size of the tab character seems to be roughly 2.88x the
size of the glyph in the font.
This fixes a text layout issue with the commander info (HP, Job, etc).
Implement EFFECT_FADEOUT, EFFECT_FADEIN, EFFECT_WHITEOUT and
EFFECT_WHITEIN.
I'm not aware of these being used in any game (fade effects seem to be
implemented manually most of the time).
Fill fully-transparent pixels on the destination texture with the text
color before rendering to it. This eliminates halos around text caused
by the invisible texture color (usually black) being blended with the
text.
Only unscaled glyph bitmaps are now cached in regular memory. Scaled
glyphs are stored as textures on the GPU. Only the alpha channel on
glyph textures is used, with the color being provided as an input to the
shader.
Outline and bold rendering is improved by using a simple dilate shader.
This looks okay but could be improved (the result is a bit blurry
still).
This improves the look and (especially) the performance of text
rendering in the MangaGamer version of Sengoku Rance.
There are still some bugs/unimplemented features, but the game should be
more or less bearable to play in this state.
The game now basically runs, but with very bad performance and lots of
aliasing on text.
Need to implement anti-aliasing and caching of rendered glyphs next.
If two sprites have the same Z value, they are rendered in increasing
order of their sprite numbers.
This fixes an issue in the MangaGamer version of Sengoku Rance, which
depends on this behavior.
This code was changed at some point so that sact_get_sprite allocates a
sprite and only returns NULL for a negative sprite index, but some
functions were still assuming that it could return NULL under normal
circumstances and trying to manually allocate sprites.
I've gone through all of the SP_* functions to check which ones allocate
a sprite and which ones don't. If a function doesn't allocate a sprite,
sact_try_get_sprite is called instead of sact_get_sprite.
This fixes a crash on startup in the MangaGamer version of Sengoku
Rance (SengokuRanceFont.SP_ClearState was incorrectly allocating a
sprite).