Commit Graph
714 Commits
Author SHA1 Message Date
Nunuhara Cabbage b60cce3e8f parts: handle zero surface area at render time
Check for uninitialized or explicitly zeroed surface area at render
time. This fixes an issue where some construction process parts would
not be rendered (specifically, the button text on the Rance 01 title
screen).
2022-06-12 14:44:08 -07:00
Nunuhara Cabbage d79020656c debugger: command modules
Allow adding groups of commands to the debugger at run time. This is
currently used only by GUIEngine.
2022-06-12 14:29:46 -07:00
Nunuhara Cabbage 49774fa4b6 Merge pull request #55 from kichikuou/SetInstanceAlpha
Implement ReignEngine.SetInstanceAlpha
2022-06-12 09:41:07 -07:00
kichikuou db97942393 Implement ReignEngine.SetInstanceAlpha 2022-06-12 21:27:49 +09:00
Nunuhara Cabbage 06949f59e8 Merge pull request #54 from kichikuou/motion
ReignEngine: Implement skeletal animation
2022-06-11 20:24:00 -07:00
kichikuou 315c7e6a50 Fix memory leaks in RE_instance_load_{,next_}motion 2022-06-12 08:52:44 +09:00
kichikuou 442ebce079 Add debug_print method to draw_plugin
Plugins can implement this so that scene_print will print additional
information for the sprite. RE_plugin implements this to dump the 3D
scene information.
2022-06-11 13:43:59 +09:00
kichikuou a2bbe15b20 ReignEngine: Implement skeletal animation 2022-06-11 13:28:02 +09: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 7e04db958b parts: implement more ConstructionProcess ops
Implement Create, CreatePixelOnly, DrawText and CopyText operations.
2022-06-10 15:28:08 -07:00
Nunuhara Cabbage 1484a207c5 Implement GUIEngine.{Set,Get}DelegateIndex 2022-06-08 17:09:47 -07:00
Nunuhara Cabbage 09f2c3e1ed parts: implement Parts_Set*SurfaceArea functions
These functions apply a clipping rectangle to the parts texture.
2022-06-08 16:51:06 -07:00
Nunuhara Cabbage 7205570611 parts: make construction process a parts type 2022-06-07 16:25:00 -07:00
Nunuhara Cabbage 7223d4d6aa Fix bug in afa_get_by_id
Fix bug where asset_get would return unloaded files from afa archives.
2022-06-06 18:18:17 -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
Nunuhara Cabbage 19ac7e6935 Refactor asset_manager (again)
There are now two types of asset management:
    1. ID-indexed assets, where IDs are not necessarily sequential
    2. name-indexed assets

Name-indexed assets can have additional archives added at run-time. This
is to support the CGManager.LoadArchive function used in Rance Quest
Magnum.

Name-indexed assets always use .afa archives. ID-indexed assets mostly
use .ald archives, except for Daiteikoku and Shaman's Sanctuary.

asset_get_by_name is now case insensitive and ignores the file
extension.
2022-06-05 19:15:41 -07:00
Nunuhara Cabbage 7eb620aca7 Refactor asset_manager
asset_exists and asset_get now take 1-indexed IDs.

Custom CG indexing code for Shaman's Sanctuary is now removed and
replaced with a proper implementation of afa v1 archives in libsys4.
2022-06-05 12:26:18 -07:00
Nunuhara Cabbage e21111bc5f Merge pull request #53 from kichikuou/fillangle
Implement FillAngle HLL
2022-06-04 21:11:04 -07:00
kichikuou 9da9f53671 Implement FillAngle HLL
This is used in Toushin Toshi III for the "clock" effect of battle
command icons.
2022-06-05 10:06:42 +09:00
Nunuhara Cabbage 53b61fa69b Merge pull request #52 from kichikuou/3d
Initial implementation of ReignEngine HLL
2022-06-03 21:51:42 -07:00
kichikuou dca30c3aab Initial implementation of ReignEngine HLL
ReignEngine is the 3D rendering engine used in Toushin Toshi III, and is
the predecessor of the 3D engines for Rance Quest, Rance 9, Evenicle,
etc.

This implements minimal functionality to be able to draw the first 3D
dungeon scene. Many important parts such as motion and lighting are not
implemented yet.
2022-06-04 11:29:07 +09:00
Nunuhara Cabbage afc7665dc8 Merge pull request #51 from kichikuou/cglm
Update cglm to v0.8.5
2022-06-03 16:47:15 -07:00
kichikuou 7d7bc00765 Update cglm to v0.8.5 2022-06-04 08:26:45 +09:00
Nunuhara Cabbage 9f7cc44949 Merge pull request #49 from kichikuou/plugin
Introduce draw_plugin
2022-05-31 16:31:13 -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 7be684e9bf Merge pull request #48 from kichikuou/tt3
Add HLL implementations for Toushin Toshi III
2022-05-28 09:23:33 -07:00
kichikuou e1268262fc Add stubs for SACTDX and SystemService functions
For Toushin Toshi III.
2022-05-28 13:09:38 +09:00
kichikuou ce8d9aaf65 Implement File2 HLL library
For Toushin Toshi III.
2022-05-28 13:09:38 +09:00
kichikuou 696601abcf Implement Toushin3Loader HLL library 2022-05-28 13:09:38 +09:00
kichikuou 941cb71a49 Implement MonsterInfo HLL
For Toushin Toshi III.
2022-05-28 13:09:35 +09:00
kichikuou 9c76a24d01 Add stubs for Confirm3 and Cursor HLLs 2022-05-22 21:02:34 +09:00
Nunuhara Cabbage 7dc4898a21 Fix outline cutoff issue with .fnl fonts 2022-05-15 09:54:10 -07:00
Nunuhara Cabbage 1fd475813d Remove unused headers 2022-05-15 09:23:11 -07: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 128edda6c0 text: fix outline cropping issue
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.
2022-05-10 19:53:31 -07:00
Nunuhara Cabbage 6070f702fa Add option to override save folder location
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.
2022-05-08 17:28:01 -07:00
Nunuhara Cabbage 8068992244 Document FreeType dependency in README 2022-05-08 17:27:45 -07:00
Nunuhara Cabbage 191bde690d Merge branch 'master' of github.com:nunuhara/xsystem4 2022-05-08 16:28:26 -07:00
Nunuhara Cabbage 2262f7067c Use FreeType2 instead of SDL_ttf
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.
2022-05-08 16:11:25 -07:00
Nunuhara Cabbage c09836e551 Use sprite draw method/blend rate for text also 2022-05-08 13:52:16 -07:00
Nunuhara Cabbage a7ca9430e8 Merge pull request #47 from kichikuou/datetime
Fix date/time getter functions
2022-05-07 22:59:18 -07:00
kichikuou 03f23c4339 Fix date/time getter functions
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`.
2022-05-08 14:20:45 +09:00
Nunuhara Cabbage 39ce914bf9 Optimize error checks in hot functions
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).
2022-05-06 20:43:30 -07:00
Nunuhara Cabbage 0b98e57938 Don't decode little endian on x86/x86_64 2022-05-06 19:27:30 -07:00
Nunuhara Cabbage b499c432fd Update game compatibility table
MangaGamer version of Sengoku Rance is now supported.
2022-05-05 21:11:25 -07:00
Nunuhara Cabbage fa4cdc81d0 Use gfx_draw_glyph for SACT2 (etc.) text rendering
This greatly improves the look of outlines, especially at larger font
sizes (such as in Haruurare).
2022-05-05 18:12:18 -07:00
Nunuhara Cabbage 0b52a4baa0 Fix issue with text blend mode
The source alpha was being multiplied by itself, making text look
thinner than it should. Now we just take the max alpha.
2022-05-05 18:09:51 -07:00
Nunuhara Cabbage 6080af3621 Implement Sound_GetGroupNumFromDataNum
Part of StoatSpriteEngine and KiwiSoundEngine.

This fixes an issue with per-channel volume settings not working
correctly in Haruurare (and presumably other games).
2022-05-04 20:30:03 -07:00
Nunuhara Cabbage 5924225bc2 Implement DrawGraph.BrightDestOnly 2022-05-03 21:08:01 -07:00