Commit Graph
300 Commits
Author SHA1 Message Date
Nunuhara Cabbage 488ccc0c74 Implmement MainEXFile HLL (Rance 01 version)
Implement the Rance 01 version of MainEXFile (later versions have a
different interface).
2021-10-22 18:34:39 -07:00
Nunuhara Cabbage 5ff042738e Initial delegates implementation
This isn't very well tested yet, but it runs Rance 01 up to the first
HLL error.
2021-10-18 10:45:10 -07:00
Nunuhara Cabbage f53184d8f7 Implement System40.ini/AliceStart.ini mixers
Implement "VolumeValancer" mixer channels from the .ini file. Mixers are
now recursive, with the master and voice channels being parent nodes
(this seems to be hardcoded in system 4, or at least I haven't found
where the hierarchy is specified).

Also implement .wai file support (needed for mixer channel info on sound
files).
2021-10-03 09:26:48 -07:00
Nunuhara Cabbage 96356094d9 Get loop info and volume from .bgi file
Music should now correctly loop in games that use .ogg audio.
2021-10-01 21:14:25 -07:00
Nunuhara Cabbage fc8e7eee22 Replace SDL_mixer with libsndfile + sts_mixer
Replace SDL_mixer with an audio implementation using libsndfile,
sts_mixer (a single-file header library) and SDL's basic audio
interface.

This allows for much more flexibility in controlling audio playback.
Fading is now properly implemented, as well as various other functions
from the SACT2/KiwiSoundEngine interface.

sts_mixer can support recursive mixing, so it will be possible to
implement the "VolumeValancer" mixer channels specified in
System40.ini in the future (once I figure out how the mapping of audio
files to mixer channels is supposed to work).
2021-09-30 22:07:04 -07:00
Nunuhara Cabbage ab5c86b1fa Implement joypad support 2021-09-19 20:28:51 -07:00
kichikuou b4bc150e16 DrawDungeon: Implement IsFloorFillTexture 2021-06-27 12:41:58 +09:00
kichikuou 7e5187e35c DrawDungeon: 2D map improvements
* Cells loaded from walk-data are half-transparent.
* The player symbol is half-transparent when showing different floors.
* Clear the texture before drawing a small map so that no garbage is
  left when the drawing is clipped.
2021-06-27 12:41:58 +09:00
kichikuou 86a5c62fc7 Fix text rendering in OpenGL ES 3
In OpenGL ES 3, glTexImage2D cannot handle GL_BGRA format. SDL_ttf
returns pixels in BGRA format (because it's the format used in
FreeType2), so it needs to be converted to RGBA before passing to
gfx_init_texture_with_pixels.
2021-06-20 17:14:40 +09:00
kichikuou 057862b533 DrawDungeon14: Draw 3D objects in PolyObj.lin 2021-06-19 22:56:06 +09:00
kichikuou 946e3bdab6 DrawDungeon14: Implement {Get,Set}DrawMapObjectFlag 2021-06-13 21:41:04 +09:00
kichikuou 1d8615d14f Initial implementation of DrawDungeon14.hll (GALZOO Island)
Major differences from DrawDungeon.hll are:

- DGN, DTX, TES are loaded from individual files, not from a DLF archive
- 2D map functions are not used
- (unimplemented) Spinning motion of event markers
- (unimplemented) Additional 3D object types (polygon models and roofs)
2021-06-13 17:00:44 +09:00
kichikuou 9c6bf5c110 DrawDungeon: Move walk-flag management code out of map.c
So that ctx->map can just be null in DrawDungeon14 (GALZOO), where 2D
maps are not drawn by the HLL.
2021-06-13 16:33:44 +09:00
kichikuou fb94881f9f Remove flip_y field from texture
It was introduced to flip texture image rendered by DrawDungeon when
presenting on the screen. In GALZOO this approach does not work because
dungeon texture is also used as the source image of gfx functions.

After this, DrawDungeon directly generates vertically flipped image, by
tweaking the projection matrix.
2021-06-13 16:14:05 +09:00
kichikuou 4d139a0ddd Implement DrawGraph.SpriteCopyAMap
Used in GALZOO Island.
2021-06-13 11:43:27 +09:00
kichikuou b5f226ff79 Fix SACT2.SP_GetMaxZ
It should return the maximum Z value among all sprites, not among
visible sprites.

This fixes a bug in Rance VI where some UI elements are incorrectly
Z-ordered.
2021-06-12 10:38:16 +09:00
kichikuou b7a1127f19 DrawDungeon: Implement SetDrawMapRadar
Some map symbols are not visible unless the radar flag is set.
2021-06-06 14:22:33 +09:00
kichikuou 2ad6eba94f DrawDungeon: Implement SetDoor[NWSE]Angle
Now door animation works.
2021-06-06 14:22:33 +09:00
Nunuhara Cabbage 74c1b38fa4 Merge branch 'master' of https://github.com/nunuhara/xsystem4 2021-05-30 18:49:49 -07:00
kichikuou 98798a6ab9 DrawDungeon: A major rewrite of dungeon renderer
Before this, all objects that share a texture were drawn at once.
Objects were not depth-sorted, so if a transparent object was drawn
first, objects behind it were not drawn.

After this, dungeon is drawn for each cell, sorted by distance from
the camera position. To reduce the number of cells to be drawn, PVS
(Potentially Visible Set) stored in dgn files is used.
2021-05-30 21:28:22 +09:00
Nunuhara Cabbage 815c1f20f0 Default font types > 1 to 0 2021-05-24 11:15:50 -07:00
Nunuhara Cabbage a4e642783b Implement ChipmunkSpriteEngine.SP_GetFontWidth
Used in Shaman's Sanctuary.
2021-05-24 11:09:49 -07:00
Nunuhara Cabbage e78a208bbd Add asset_cg_exists function 2021-05-24 11:00:56 -07:00
kichikuou d92c5ab39d DrawDungeon: Use cglm's mat4 type in render function parameters
Pure refactoring, no behavior changes.
2021-05-23 14:52:42 +09:00
kichikuou 93f624aa43 Implement DrawDungeon.CalcConquer 2021-05-23 14:11:18 +09:00
kichikuou fa5ed2db35 Implement DrawDungeon.{Load,Save}WalkData
Also fixes compiler warnings in map.c.
2021-05-23 14:11:18 +09:00
kichikuou ce004ee3cc Make {gamedir,savedir}_path accept absolute paths
This fixes Rance VI which passes SACT2.SP_SaveCG and
SACT2.SP_SetCGFromFile absolute paths like
`system.GetSaveFolderName() + "\\" + "ScreenA.qnt"`.

Also, now savedir_path() uses unix_path() rather than sjis2utf().
2021-05-22 17:07:14 +09:00
kichikuou ea513ca727 Implement SACT2.SaveCG
Used in Rance VI.
2021-05-22 17:07:14 +09:00
Nunuhara Cabbage 7eb6216b80 Add audio_play_sound function
Implement a system for allocating anonymous channels so that libraries
can play sounds without having to manage channels.

A library that uses audio_play_sound must ensure that audio_update is
called periodically to garbage collect finished channels.
2021-05-21 23:30:16 -07: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 512c1dee2a Implement DrawGraph.CopyStretchBlend{AMap}
Used in Haru Urare.

Also, redirect DrawGraph.CopyStretch{AMap}Interp to the regular
implementations (bilinar interpolation is default).
2021-05-17 09:01:11 -07:00
Nunuhara Cabbage d7286a2f30 Implement DrawGraph.CopyRotateY{UseAMap}
Used in Haru Urare.
2021-05-17 08:01:35 -07:00
Nunuhara Cabbage 3b7fb2c60c Use mat4 type from cglm instead of GLfloat[16]
Also reimplement DrawGraph.CopyRotZoom using cglm functions.
2021-05-16 17:34:42 -07:00
Nunuhara Cabbage f768fed99c Merge branch 'master' of https://github.com/nunuhara/xsystem4 2021-05-16 12:18:39 -07:00
Nunuhara Cabbage f25e26ecf4 Refactor archive management code
Implement a new interface for managing archives. This is mainly to
support loading afa archives alongside ald archives.

Also included here is some code for creating an index for afa CG
archives (the numbers used to reference CGs in afa archives correspond
to the file name, not the position in the archive).
2021-05-16 08:06:40 -07:00
Nunuhara Cabbage 770b517f07 Merge pull request #24 from kichikuou/blur
Implement DrawGraph.Copy{,AMap}{Width,Height}Blur
2021-05-16 07:26:51 -07:00
kichikuou 91213785a7 Implement DrawGraph.Copy{,AMap}{Width,Height}Blur 2021-05-16 22:04:40 +09:00
kichikuou e066c428cd DrawDungeon.hll: Implement 2D maps 2021-05-16 18:21:38 +09:00
Nunuhara Cabbage 92b81f21ee Add stubs for ChipmunkSpriteEngine
Used in Shaman's Sanctuary. Mostly identical to StoatSpriteEngine, but
with a few additions and some removed functions (notably, the
MultiSprite functions were removed).
2021-05-15 18:55:24 -07:00
Nunuhara Cabbage 50a719ba76 Implement DrawGraph.FillAMap{Over,Under}Border
Used in Alice 2010.
2021-05-14 18:35:29 -07:00
Nunuhara Cabbage 291bb82be6 Implement DrawGraph.CopyStretchWithAlphaMap 2021-05-13 18:34:17 -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 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 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 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 713a612d2c Implement DrawGraph.CopyWithAlphaMap
Used in Haru Urare.
2021-05-09 16:19:57 -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 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
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