Commit Graph
21 Commits
Author SHA1 Message Date
kichikuou de0646e430 Implement ChipmunkSpriteEngine.SP_{Suspend,Resume,IsSuspend}
Their exact meaning is unknown; currently it is just a read/write
boolean flag.
2025-05-18 11:23:27 +09:00
kichikuou dc8a9379d0 Implement DrawSnow HLL
Used in Tsuma Shibori, and some indie System 4 games.

This HLL is a draw plugin that uses SACT2's "custom sprite" mechanism.
Custom sprites do not have a texture. Instead, the plugin's render()
callback draws them directly to the main surface.
2024-11-01 08:53:58 +09:00
kichikuou 1887ceff7f Fix sact_SP_TextNewLine when nTextSize is 0
Text sprites hold the height of the text drawn on them, and
sact_SP_TextNewLine increases the Y coordinate by this value if
nTextSize is 0.

The nTextSize argument of sact_SP_TextHome affects this value.

Beat Blades Haruka depends on this behavior.
2023-06-04 12:04:28 +09:00
Nunuhara Cabbage 7392d74efe Replace debug_print with to_json
to_json and cJSON_Print are now used when displaying debug information.

The main reason for this change it to support sending objects over DAP.
2023-05-14 20:12:34 -07:00
Nunuhara Cabbage 2237bb814c Implement various HLL functions for Rance Quest
Most of the functionality of gfx_render_texture (draw method, blend
rate) is moved into sprite_render, since this was the only place using
it.
The draw method and blend rate are now stored in sact_sprite objects
instead of textures.
sact_sprite now has two renderers: the old SACT2 renderer (with blend
rate as the only shader parameter) and the new ChipmunkSpriteEngine
renderer, which supports multiply/add colors and the "surface area"
feature from PartsEngine.

Rance Quest now runs up to the first Flash-related function call
(Flash?!?!).
2023-02-12 15:59:36 -08:00
Nunuhara Cabbage caec854ed8 Implement scene_print function
Add a scene_print function which prints a textual representation of the
current scene. This works by attaching a `debug_print` function to each
entity in the scene. This function is implemented for SACT2 and
GUIEngine entities. A default implementation will be used of none is
provided.

This can be accessed from the debugger via the `scene` command (although
the output is typically too much to view in a terminal; it's better to
run `scene_print` somewhere and redirect stdout to a file).
2022-06-10 19:18:10 -07:00
Nunuhara Cabbage eaa0baad7f Handle library incompatibilities
Add a mechanism for libraries to resolve incompatibilities between
library versions before linking.

This is currently used for ChipmunkSpriteEngine and GoatGUIEngine,
where early versions used integer IDs when loading CGs (later versions
use strings).
2022-06-06 08:49:12 -07:00
kichikuou 81ff379eb8 Avoid iterating over the scene for plugins update
Now plugin is a member of sact_sprite, and sprite.c manages a list of
sprites with plugins.
2022-05-31 18:13:08 +09:00
kichikuou fd4cd139f8 Introduce draw_plugin
This introduces draw_plugin struct that can be attached to a sprite.
The update() function of attached plugin is called every frame by
sact_Update(). This corresponds to the DrawPlugin mechanism of
System4/SACT2.

This is currently used only from DrawDungeon. The 3D engine for Toushin
Toshi 3 etc. will also use this.
2022-05-30 11:41:20 +09:00
Nunuhara Cabbage 9b83a6d09d Refactor text rendering code
.fnl fonts can now be used outside of SengokuRanceFont, and
SengokuRanceFont now uses the same text layout and caching code as
SACT2, etc.
2022-05-14 23:12:36 -07:00
Nunuhara Cabbage 8fb0153963 SengokuRanceFont: anti-aliasing and glyph caching
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.
2022-04-24 17:19:27 -07:00
Nunuhara Cabbage 912a73d42a Implement HLLs for English version of Rance VI 2022-04-10 18:24:47 -07:00
kichikuou ba1dcd6e21 Fix StoatSpriteEngine.SP_SetDrawMethod
The method parameter of this function has a different meaning from that
of SACT2.SP_SetDrawMethod.

I've only checked it in Widenyo, but it seems 0 and 1 are valid values
and 1 is additive blending.
2022-03-25 10:49:25 +09:00
kichikuou 2707bc9a7e Implement MapLoader HLL
For Widenyo.

Now sprite_set_cg() takes a struct cg, so that CG can be loaded from
custom sources such as .map file.
2022-03-25 10:29:30 +09:00
kichikuou ea513ca727 Implement SACT2.SaveCG
Used in Rance VI.
2021-05-22 17:07:14 +09:00
Nunuhara Cabbage dd985a3769 Refactor sprite/scene management code
Create a separate interface for managing the scene. The sact_sprite
interface is implemented on top of this, as is GoatGUIEngine (which is
now independent of sact_sprite).

This will allow more specialized graphics interfaces to be implemented
without adding to the complexity of the sact_sprite interace. (For
example, GoatGUIEngine needs to store multiple textures per sprite for
button states; this is not supported by sact_sprite.)
2021-05-21 18:56:33 -07:00
Nunuhara Cabbage eba29786bc Partial implementation of GoatGUIEngine
Enough to get to the main menu in Shaman's Sanctuary.
2021-05-20 18:19:52 -07:00
Nunuhara Cabbage 4120e344f1 Fix SACT2.SP_CreatePixelOnly
Create pixel-only textures as RGB (no alpha). This fixes some issues
with DrawGraph functions writing to an alpha channel that shouldn't
exist (e.g. causes black screen in Haru Urare).

This doesn't fix the analogous issue for CGs which shouldn't have an
alpha channel.
2021-05-10 22:11:28 -07:00
kichikuou c561317fb9 Implement SACT2.SP_SetCGFromFile
It's useful when testing graphics functions.
2021-05-09 09:07:37 +09:00
Nunuhara Cabbage 058eee03e5 Fix various issues with SACT2
Ensure that sact_get_sprite always returns a sprite object if sprite
number is not negative. SACT2 functions in general should work before
pixel data is attached to a sprite.

This also fixes the default for the 'show' property (true) and changes
the logic for adding/removing sprites from the scene to be less
error-prone (checked whenever a sprite is dirtied).
2021-05-06 20:11:33 -07:00
Nunuhara Cabbage 4f75f2d7ed Refactor sact_graphics.c
Split the code from sact_graphics.c into sprite.c and hll/SACT2.c.
sprite.c contains an index-independent sprite/scene interface, whereas
hll/SACT2.c handles the indexing of sprites.

This is to better support the StoatSpriteEngine.MultiSprite_* functions,
which use a different indexing system.
2021-05-01 13:55:08 -07:00