Commit Graph
998 Commits
Author SHA1 Message Date
kichikuou 10710e9908 ReignEngine: Cache parsed particle effects
Now parsed particle-effect definitions are cached in a hash map in the
plugin object. To make it possible, static part of `struct
particle_effect` and `struct particle_object` are factored out to
`struct pae` and `struct pae_object` respectively.
2022-12-28 13:18:41 +09:00
kichikuou defeb0ba17 ReignEngine: Cache loaded models
When there are multiple instances of a model, now they share a single
model object. Model objects are retained in a hash table until the
plugin is released, which is fine because Toushin Toshi 3 doesn't reuse
a plugin across scenes.
2022-12-28 13:18:41 +09:00
Nunuhara Cabbage 9a8e3c59ec Fix use-after-free in font_freetype.c
Pointers to `struct font_size` objects are cached in `struct text_style`
objects, so the `sizes` array can't be reallocated.

This fixes a crash in Rance 02 when entering battle.
2022-12-27 10:14:14 -08:00
Nunuhara Cabbage f23d713f46 Merge pull request #91 from kichikuou/effect
Implement EFFECT_NOISE_CROSSFADE and EFFECT_SEPIA_NOISE_CROSSFADE
2022-12-27 10:11:54 -08:00
Nunuhara Cabbage 1f84f33346 Merge pull request #90 from kichikuou/reign
ReignEngine improvements
2022-12-27 10:11:27 -08:00
kichikuou 8aafb271f9 Implement EFFECT_NOISE_CROSSFADE and EFFECT_SEPIA_NOISE_CROSSFADE
EFFECT_SEPIA_NOISE_CROSSFADE is frequently used in Toushin Toshi 3.
2022-12-27 21:13:01 +09:00
kichikuou c7cebb9ea9 ReignEngine: Fix out-of-range material index in .POL
Without this, some maps (e.g. map059) and battle backgrounds
(e.g. bg101) in Toushin Toshi 3 are not rendered correctly.
2022-12-24 16:54:41 +09:00
kichikuou 2de5132803 ReignEngine: Support (sprite) mesh attribute
It has the same effect as the (sprite) material attribute.

Also, now sprite objects are rendered in the DRAW_OPAQUE phase.
2022-12-24 16:54:40 +09:00
kichikuou 70b4071350 ReignEngine: Support "shadow darkness" material parameter
It is a value between 0.0 and 1.0, where 0.0 means no shadows are drawn
on the material.
2022-12-24 16:54:40 +09:00
kichikuou eb13ae0cc1 ReignEngine: Fix rendering issue of skinned models without motion
This fixes a bug where skinned instances with no motion loaded were not
drawn.
2022-12-24 16:54:40 +09:00
kichikuou 06b9da800c Implement ReignEngine.SetInstanceDebugDrawShadowVolume
It visualizes the bounding sphere of the instance. Although it is only
called from dead code in Toushin Toshi 3, it's useful for debugging
shadow mapping.
2022-12-24 16:54:37 +09:00
kichikuou fdd0af8dcf ReignEngine: Improve shadow view-frustum calculation
This fixes broken shadow rendering e.g. when Nacht climbs a ladder.

Now update_bones() calculates the instance's bounding sphere which
is the minimum sphere containing the AABB of current bone coordinates.
This corresponds to the sphere that is displayed when calling
SetInstanceDebugDrawShadowVolume on the original ReignEngine.dll.
2022-12-24 16:25:05 +09:00
Nunuhara Cabbage cfaed35f23 Merge pull request #89 from kichikuou/half-width
font_freetype: Fix display width of half-width kana and some symbols
2022-12-21 18:52:05 -08:00
Nunuhara Cabbage f2f5391ae8 Merge pull request #88 from kichikuou/DrawMovie
Add stubs for DrawMovie library
2022-12-21 18:51:16 -08:00
kichikuou 1bcf026f25 font_freetype: Fix display width of half-width kana and some symbols
Halfwidth katakana are now displayed in half-width.

This also fixes an issue where some symbols with codepoint <256 (e.g.
MULTIPLICATION SIGN) were considered half-width, while the bundled font
has full width glyphs for those codepoints.
2022-12-18 14:57:04 +09:00
kichikuou acb814021c Add stubs for DrawMovie library
Used in Toushin Toshi 3. The interface is the same as DrawMovie2.
2022-12-18 10:27:34 +09:00
Nunuhara Cabbage de7cbf1c1e Merge pull request #87 from kichikuou/reign
ReignEngine improvements
2022-12-16 21:53:33 -08:00
kichikuou 8c72c5b5e0 ReignEngine: Normalize vectors after applying normal_transform
normal_transform can be non-orthogonal, so after transforming with it
direction vectors must be normalized.

This fixes a bug where President Garter is rendered too specular.
2022-12-17 10:59:16 +09:00
kichikuou 9a6553f215 ReignEngine: Fix glTexImage2D arguments for shadow renderer
GL_DEPTH_COMPONENT is not a valid value for internalFormat in OpenGL ES.
2022-12-17 10:59:16 +09:00
kichikuou 3ef252c68b ReignEngine: Improve z-sorting
This fixes billboard rendering issue in some dungeons.

* For polygon models, use its AABB's center coordinates.
* Consider the camera angle, i.e. sort by view-space Z-coordinate
  instead of world-space Z-coordinate.
2022-12-17 10:59:16 +09:00
kichikuou 6cc0bd7cb4 ReignEngine: Implement (both) mesh attribute
I'm not sure what it means exactly, but at least it disables shadow
drawing (but does not disable shadow casting).
2022-12-17 10:59:16 +09:00
kichikuou 02b0c8c80c ReignEngine: Implement (nomakeshadow) mesh attribute 2022-12-17 10:59:16 +09:00
Nunuhara Cabbage a0f4f9a4ab Merge pull request #86 from kichikuou/effect
Implement EFFECT_TV_SWITCH_ON
2022-12-11 16:42:37 -08:00
kichikuou 86bee21a9d Implement EFFECT_TV_SWITCH_ON
Used in Toushin Toshi 3.
2022-12-11 21:48:02 +09:00
Nunuhara Cabbage 4897dbf3c7 Merge pull request #85 from kichikuou/reign
ReignEngine improvements
2022-12-10 13:42:57 -08:00
kichikuou b79eb9ccea ReignEngine: Do not WARNING() on SetBackCGName("")
It just unloads current CG.
2022-12-10 11:34:34 +09:00
kichikuou 408f35f4ec Fix ReignEngine.SetInstanceScaleZ 2022-12-10 11:26:14 +09:00
kichikuou 5b9e7ac7e4 ReignEngine: Correctly mark transparent materials
There are two types of transparent materials: materials that have an
alpha map and materials that have a color map with an alpha channel.
This change makes the latter to be considered transparent.
2022-12-10 11:25:42 +09:00
kichikuou c5b0122d72 ReignEngine: Use glDepthFunc(GL_LEQUAL) when drawing billboards
So that multiple billboards overlapping on a plane are rendered
correctly.
2022-12-10 11:24:38 +09:00
Nunuhara Cabbage 0d83bce07d Merge pull request #84 from kichikuou/R_NOTE
Implement R_NOTE instruction
2022-12-04 07:52:41 -08:00
kichikuou f78013b70b Implement R_NOTE instruction
It corresponds to the !== operator.
2022-12-04 17:14:19 +09:00
Nunuhara Cabbage 592e7c3f9f Merge pull request #83 from kichikuou/data-hll
Implement Data.hll
2022-12-03 22:54:09 -08:00
kichikuou f152f41d0a Implement Data.hll
No AliceSoft game uses this, but it's included in the System4 SDK and
used by some indie games.
2022-12-03 09:47:16 +09:00
Nunuhara Cabbage 7aaa19404c Merge pull request #82 from kichikuou/mmap
Do not use ARCHIVE_MMAP on 32-bit systems
2022-11-26 20:34:01 -08:00
kichikuou 6efa31454d Do not use ARCHIVE_MMAP on 32-bit systems
Some games have assets that are too large to mmap everything on a 32-bit
address space. For example, TT3 has a total of 2.82GB of assets, which
is too large for the 3GB address space limit of 32-bit Linux. On Android
it's even stricter and mmaps of hundreds of MB can fail.
2022-11-26 22:29:57 +09:00
Nunuhara Cabbage 31e91cc3ad Merge pull request #81 from kichikuou/font
font_freetype: Consider glyph information for horizontal positioning
2022-11-24 19:25:08 -08:00
Nunuhara Cabbage b9637a59ff Merge pull request #80 from kichikuou/drawtype
ReignEngine: Implement {Get,Set}InstanceDrawType
2022-11-24 19:16:50 -08:00
kichikuou 638de2057a font_freetype: Consider glyph information for horizontal positioning
When creating a block-sized texture from a glyph, use the bitmap_left
field of FT_GlyphSlot instead of just centering it horizontally.

This improves positioning of punctuation marks in Japanese text.
2022-11-20 12:02:18 +09:00
kichikuou 28f95bfe38 ReignEngine: Implement {Get,Set}InstanceDrawType
Billboards of draw type 1 are drawn with additive blending.
2022-11-20 09:47:10 +09:00
Nunuhara Cabbage c296ca1682 Merge pull request #79 from kichikuou/cursor
Implement Cursor.Set HLL function
2022-11-19 08:32:59 -08:00
kichikuou 33760da0fa Implement Cursor.Set HLL function
In Toushin Toshi 3, it is used only to show / hide the mouse cursor.
2022-11-19 21:46:11 +09:00
Nunuhara Cabbage 36d2216e66 Merge pull request #78 from kichikuou/reign
ReignEngine: Per-mesh control of drawing order
2022-11-16 20:20:56 -08:00
kichikuou 00d1d01353 ReignEngine: Per-mesh control of drawing order
Before this, the order of drawing was determined on an instance-by-
instance basis. Instances with even a single transparent material were
drawn after fully opaque instances.

After this, first the opaque meshes in all instances are drawn, and then
the transparent meshes are drawn from the nearest to the farthest.
2022-11-13 14:20:31 +09:00
Nunuhara Cabbage a3e3232825 Update libsys4 2022-11-11 20:28:45 -08:00
Nunuhara Cabbage eec9663145 Merge pull request #77 from kichikuou/tt3
ReignEngine improvements
2022-11-09 16:37:53 -08:00
kichikuou 5f17dafdf8 ReignEngine: Set correct initial value for fog parameters
This fixes rendering issue of the model viewer in Alice's Mansion.
2022-11-05 22:17:38 +09:00
kichikuou 581593f9b5 ReignEngine: Support (env) mesh attribute
If specified, the mesh should be rendered with environment mapping
using the material's COLOR_MAP as a matcap texture.
2022-11-05 20:56:26 +09:00
kichikuou 241f631d9d ReignEngine: Set loop frame range for particle effects
Without this, update_motion cannot calculate current_frame correctly
when the effect is used with RE_MOTION_STATE_LOOP state.
2022-11-05 20:56:26 +09:00
kichikuou 814ebb7d3d ReignEngine: Support (sprite) material attribute
If specified, alpha test is used instead of alpha blend.
2022-11-05 20:56:25 +09:00
kichikuou 1a9a2e9753 ReignEngine: Support (nolighting) mesh attribute
In ReignEngine, the mesh name field may contain keywords that change
rendering behavior. The "(nolighting)" keyword disables lighting and
fog.
2022-11-05 20:56:25 +09:00