Commit Graph
431 Commits
Author SHA1 Message Date
Nunuhara Cabbage 3249138bf4 Implement SH_REF_LOCAL_ASSIGN_STRUCTREF2
Used in Haruka VS Escalayer
2021-05-13 20:07:16 -07:00
Nunuhara Cabbage 291bb82be6 Implement DrawGraph.CopyStretchWithAlphaMap 2021-05-13 18:34:17 -07:00
Nunuhara Cabbage ca8cdddb3b Allow Array.Fill on empty array 2021-05-13 18:09:13 -07:00
Nunuhara Cabbage b3783178f4 Implement MultiSprite_SetOriginPosMode
Used in Rance 02.
2021-05-12 22:02:48 -07:00
Nunuhara Cabbage 10d838ebc4 Fix bug when loading heap
Need to grow as needed.
2021-05-12 19:36:48 -07:00
Nunuhara Cabbage 2a9e7a417b Implement CharSpriteMangager_{Rebuild,Save,Load} 2021-05-12 19:35:53 -07:00
Nunuhara Cabbage d5cbea3f94 Implement various SystemService functions
Enough so that Haru Urare doesn't crash in the settings menu.
2021-05-12 16:42:35 -07:00
Nunuhara Cabbage ba2accdf58 Implement remaining instructions for Haru Urare
A few of the new instructions which were not used in that game are still
unimplemented.
2021-05-12 16:40:51 -07:00
Nunuhara Cabbage dffbd3125c Fix StoatSpriteEngine.ADVLogList_GetADVLogVoice
This function has a different interface than the AnteaterADVEngine
version.
2021-05-11 19:32:59 -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
Nunuhara Cabbage 968179fadb Guard against division by zero
Happens in Haru Urare, apparently this is not an error.
2021-05-10 22:07:23 -07:00
Nunuhara Cabbage 20e25a8860 SACT2: Don't allocate sprite in getter functions
SACT2.SP_Get* functions shouldn't allocate a sprite if the given sprite
number isn't allocated.
2021-05-10 20:27:33 -07:00
Nunuhara Cabbage c735ee5af2 Fix DrawGraph.GetAlphaColor/SACT2.SP_GetAMapValue
Properly handle cases where the coordinate is outside of the sprite.
Fixes an issue on the Haru Urare menu sceen.
2021-05-09 21:49:53 -07:00
Nunuhara Cabbage e74fc33cf0 Add stubs for miscellaneous HLL functions
Used in Haru Urare.
2021-05-09 20:55:37 -07:00
Nunuhara Cabbage 2365fb3a01 Implement various SH_ instructions
Implement various shorthand instructions introduced in Alice 2010. This
is enough to get through the first scene in Haru Urare.
2021-05-09 20:53:32 -07:00
Nunuhara Cabbage 74230869ae Fix memory leak in ACXLoader 2021-05-09 19:18:47 -07:00
Nunuhara Cabbage 713a612d2c Implement DrawGraph.CopyWithAlphaMap
Used in Haru Urare.
2021-05-09 16:19:57 -07:00
Nunuhara Cabbage 649c0d530e Implement FileOperation.Get{File,Folder}List
Used in Haru Urare.
2021-05-09 15:18:13 -07:00
Nunuhara Cabbage 16b026b7b6 Add stubs for IbisInputEngine
Used in Alice 2010.
2021-05-09 15:17:47 -07:00
Nunuhara Cabbage 5a28c73492 Implement MultiSprite text functions
Implement StoatSpriteEngine.MultiSprite_SetText and related functions.
2021-05-09 12:14:54 -07:00
Nunuhara Cabbage 35d3f58395 Merge pull request #22 from kichikuou/SP_SetCGFromFile
Implement SACT2.SP_SetCGFromFile
2021-05-08 21:02:33 -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 8a42494b11 Implement Math.SetSeedByCurrentTime
Used in Alice 2010
2021-05-08 11:43:03 -07:00
Nunuhara Cabbage 49458585d6 Implement ADVSceneKeeper functions
This is a serialization interface for a particular struct type. I've
implemented it somewhat generically, only checking that the name of the
struct matches the expected type. The actual structure of the objects
passed in is not checked, and in fact this structure differs between
games.

The serialized data produced by ADVSceneKeeper.Save should be identical
to what's produced by AnteaterADVEngine.dll from Shaman's Sanctuary.
2021-05-08 10:52:47 -07:00
Nunuhara Cabbage 5c6793d012 Merge pull request #21 from kichikuou/DrawDungeon
Initial implementation of DrawDungeon.hll (Rance VI)
2021-05-08 09:21:48 -07:00
kichikuou 89e37c2428 Add dependency wrap file for cglm
Since libcglm-dev is not available in Debian buster (added in bullseye).
2021-05-08 22:42:57 +09:00
kichikuou adb558c67c Initial implementation of DrawDungeon.hll (Rance VI)
In addition to DrawDungeon.c, this adds the following files in
{src,include}/dungeon/:

- dgn.{h,c}: Parser for .dgn (map data)
- dtx.{h,c}: Parser for .dtx (textures)
- tes.{h,c}: Parser for .tes (sound IDs associated with textures)
- dungeon.{h,c}: Renderer main routines
- mesh.{h,c}: Renderer for walls and stairs
- skybox.{h,c}: Renderer for background cubemap
- event_markers.{h,c}: Renderer for event markers

And the following changes are made to the existing graphics code:

- sact_Update() calls dungeon_update(), so that event markers animate
- gfx_render_texture() renders vertically flipped image when
  texture.flip_y == true (see the comment in dungeon_context_create())

Some features are not implemented yet, including 2D maps and door
animation.

This makes cglm a dependency.
2021-05-08 22:42:57 +09:00
Nunuhara Cabbage 788a6ef82c Merge pull request #20 from kichikuou/blend
Implement DrawGraph.BlendAMapColor and DrawGraph.BlendDA_DAxSA
2021-05-08 06:41:32 -07:00
kichikuou e5cb875f9b Implement DrawGraph.BlendAMapColor and DrawGraph.BlendDA_DAxSA
And fixes DrawGraph.SubDA_DAxSA.
2021-05-08 20:52:48 +09:00
Nunuhara Cabbage 28ca3d01e2 Implement StoatSpriteEngine.CharSprite functions
With the exception of the Rebuild, Save and Load functions.

Used in 僕だけの保健室
2021-05-06 20:58:10 -07: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 601bb1d556 Implement AnteaterADVEngine.ADVLogList functions
These functions were originally part of StoatSpriteEngine but were moved
to a separate library in Shaman's Sanctuary. This implementation should
be fully compatible with AnteaterADVEngine.dll, even if the game were to
inspect the serialized data produced by ADVLogList_Save.

Also added here is a minimal implementation of CrayfishLogViewer.hll.
This is a debug API but it's useful for creating test cases that can
run on both System40.exe and xsystem when system.Output is not
available.
2021-05-06 09:57:17 -07:00
Nunuhara Cabbage 9202454ed1 Add stubs for StoatSpriteEngine.SYSTEM_* functions
Also implement StoatSpriteEngine.SP_DeleteAll
2021-05-03 17:41:53 -07:00
Nunuhara Cabbage 65868cde8f Implement MultiSprite_SetAllShowMessageFrame
Apparently type 0 is used for CGs that should disappear together with
the message frame when right clicking.
2021-05-02 19:51:29 -07:00
Nunuhara Cabbage 0fb1ef1c05 Implement DrawGraph.FillWithAlpha
Used in Vanish!
2021-05-02 18:05:40 -07:00
Nunuhara Cabbage 8ae67056c6 Implement system.CopySaveFile 2021-05-02 17:36:17 -07:00
Nunuhara Cabbage 73db60afb3 Implement VSFile.hll 2021-05-02 17:34:14 -07:00
Nunuhara Cabbage c0954e3a72 Add stubs for DrawMovie2.hll 2021-05-02 16:29:38 -07:00
Nunuhara Cabbage ab052e0246 Implement Math.Ceil 2021-05-02 16:09:06 -07:00
Nunuhara Cabbage b986789b64 Initial implementation of StoatSpriteEngine
Implement the SP_SetText* and MultiSprite_* functions added by
StoatSpriteEngine (as well as the TRANS_* functions introduced in
SACTDX). Enough to get to the opening movie in Vanish!
2021-05-02 16:07:06 -07:00
Nunuhara Cabbage 863666ed6d Move StoatSpriteEngine impl to separate file
Also clean up some redundant functions in hll/SACT2.c
2021-05-01 22:04:49 -07:00
Nunuhara Cabbage 9a8ad87ae1 Merge branch 'master' of https://github.com/nunuhara/xsystem4 2021-05-01 13:59:12 -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
Nunuhara Cabbage bbfc516045 Merge pull request #19 from kichikuou/array-fix
Fix vm_copy() for reference types
2021-05-01 07:27:32 -07:00
kichikuou a0d833649a Fix vm_copy() for reference types
This fixes a use-after-free bug in the first battle of Rance VI.
2021-05-01 19:50:09 +09:00
kichikuou eda0fc244f Add an early return to array_copy()
This fixes test_array_copy() broken by 0274052.
2021-05-01 19:49:33 +09:00
Nunuhara Cabbage 0274052947 Fix memory leak in A_ALLOC
Need to free dst page if already allocated.
2021-04-27 19:15:28 -07:00
Nunuhara Cabbage 9b84e38874 Fix double-free of unimplemented return value
When returning an empty string, the reference count must be
incremented.

Fixes crash when closing AliveZ.
2021-04-27 16:59:38 -07:00
Nunuhara Cabbage db1daa5be7 Add stubs for AliceLogo4 library
Used in Vanish!
2021-04-25 19:25:54 -07:00
Nunuhara Cabbage f0fc236903 Implement system.DeleteSaveFile
Used in Vanish!
2021-04-25 19:25:13 -07:00