Commit Graph
353 Commits
Author SHA1 Message Date
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 f145502f20 SACT2.SP_SetBrightness: don't warn default value
MangaGamer's version of Sengoku Rance calls SP_GetBrightness and then
SP_SetBrightness with the returned value, generating a lot of spurious
warnings. This just silences these warnings when setting to the default
value (255).
2021-09-20 19:34:45 -07:00
Nunuhara Cabbage ab5c86b1fa Implement joypad support 2021-09-19 20:28:51 -07:00
Nunuhara Cabbage 5ea1b871eb CrayfishLogViewer.AddText: convert to UTF-8 2021-09-19 19:16:20 -07:00
Nunuhara Cabbage bb8497e343 GoatGUIEngine: fix motion on child parts
Properly handle motions on non-root parts.
2021-07-15 20:25:12 -07:00
Nunuhara Cabbage db0922606a GoatGUIEngine: don't render hidden parts 2021-07-12 10:23:01 -07:00
Nunuhara Cabbage 8ce4ed64cf GoatGUIEngine.SetOnCursorShowLinkPartsNumber 2021-07-12 10:20:27 -07:00
Nunuhara Cabbage 6155855154 Fix bug in array.Find
Compare string values when given an array of strings.

Fixes a bug in Shaman's Sanctuary that caused the prologue to loop
infinitely.
2021-07-11 15:17:45 -07:00
Nunuhara Cabbage af71a6b6ea Fix memory leak in AnteaterADVEngine 2021-07-11 15:16:52 -07:00
Nunuhara Cabbage 382b339941 Implement ZIGZAG_CROSSFADE effect
Used in Shaman's Sanctuary.

This implementation doesn't give the same result as SACT2.dll. SACT2.dll
zigzag's the image along both axes, whereas this implementation only
does the zigzag along one axis.
2021-07-11 11:58:56 -07:00
Nunuhara Cabbage 35a84ba708 Implement BLUR_CROSSFADE effect
Used in Shaman's Sanctuary.

This implementation gives a bit of a different result compared to
SACT2.dll, but it's reasonably close.
2021-07-08 20:07:43 -07:00
Nunuhara Cabbage 75539d4cdc Implement BLIND_LR effect
Very frequently used across many games.
2021-07-07 20:14:25 -07:00
kichikuou b4bc150e16 DrawDungeon: Implement IsFloorFillTexture 2021-06-27 12:41:58 +09:00
kichikuou 9bac420a82 DrawDungeon: Disable face culling for stairs
So that the back side of stairs are visible.
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
Nunuhara Cabbage 08edf8638b Merge branch 'master' of https://github.com/nunuhara/xsystem4 2021-06-20 11:00:41 -07:00
Nunuhara Cabbage b4b85c1f75 Implement crossfade mosaic effect
This one is used quite frequently in Sengoku Rance.

The implementation here is slightly wrong, in that the anchor point for
the pixel zoom is at the lop left of the screen instead of the center.
2021-06-20 10:46:53 -07: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 da5ac4a26c Support OpenGL ES 3.0
This adds `USE_GLES` compile-time flag. If it's defined, gfx_init()
requests an OpenGL ES >=3.0 context.

This also makes the following changes to make it work with OpenGL ES:

- The USE_GLES flag also switches shader's #version directive, which is
  now provided separately from the .glsl file.
- Implicit conversion between int and float is not supported in GLSL ES.
- Use GL_RGB in gfx_copy_main_surface. Because main_surface is in GL_RGB
  format, using GL_RGBA generates GL_INVALID_OPERATION in OpenGL ES.
2021-06-20 17:12:35 +09:00
Nunuhara Cabbage 12b755ba87 Use shaders for effects
Shaders will be required to implement more complex effects (e.g. mosaic
crossfade).
2021-06-19 19:38:27 -07:00
kichikuou 057862b533 DrawDungeon14: Draw 3D objects in PolyObj.lin 2021-06-19 22:56:06 +09:00
kichikuou 5adf8f090e DrawDungeon14: Draw roofs
This is used only in the first map of GALZOO.
2021-06-19 14:54:34 +09:00
Nunuhara Cabbage 6de5b52b17 Add stub for Sound_GetGroupNumFromDataNum
From KiwiSoundEngine, used in Shaman's Sanctuary.
2021-06-13 07:09:30 -07:00
kichikuou 946e3bdab6 DrawDungeon14: Implement {Get,Set}DrawMapObjectFlag 2021-06-13 21:41:04 +09:00
kichikuou 1fdd88ff4d DrawDungeon14: Implement spinning motion of event markers 2021-06-13 21:41:00 +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 09adefe478 Implement Math.BezierCurve
Used in GALZOO Island.
2021-06-13 14:19:38 +09:00
Nunuhara Cabbage 28fbe3d95b GoatGUIEngine: add stub for vibration motion
Also fix a dangling pointer bug where child parts were not re-parented
to the scene after their parent was released.
2021-06-12 21:57:21 -07:00
kichikuou 66d6fc38da Implement DrawSimpleText HLL
Used in GALZOO Island.
2021-06-13 13:14:57 +09:00
kichikuou 4d139a0ddd Implement DrawGraph.SpriteCopyAMap
Used in GALZOO Island.
2021-06-13 11:43:27 +09:00
Nunuhara Cabbage 5464e6c35a GoatGUIEngine: implement sound motion type 2021-06-12 10:33:15 -07:00
Nunuhara Cabbage 6d8eaf90d4 GoatGUIEngine: implement hgauge/vgauge motion type 2021-06-12 10:03:49 -07:00
Nunuhara Cabbage b759070020 GoatGUIEngine: implement numeral motion type 2021-06-12 09:38:21 -07:00
Nunuhara Cabbage 7e3e67c009 Implement GoatGUIEngine.SetNumeralCG 2021-06-12 09:28:23 -07:00
Nunuhara Cabbage aba692be6b GoatGUIEngine: implement CG motion type 2021-06-11 23:40:39 -07:00
Nunuhara Cabbage a3dc6fcd4d GoatGUIEngine: implement gauge parts 2021-06-11 20:46:09 -07:00
Nunuhara Cabbage a0fb7b7bc5 GoatGUIEngine: implement numeral parts 2021-06-11 19:41:24 -07: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
Nunuhara Cabbage d9de9b962b GoatGUIEngine: fix text location issues 2021-06-10 19:30:08 -07:00
Nunuhara Cabbage 0cc3f4de21 Implement GoatGUIEngine.SetParentsPartsNumber
The parts list is now a tree, and only a single sprite is registered in
the global scene. GoatGUIEngine now manages rendering order of its own
sprites internally.
2021-06-06 19:01:49 -07:00
kichikuou 7a9cc95eef DrawDungeon: Don't warn for functions that can be safely ignored 2021-06-06 14:22:33 +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 d41d28b35d DrawDungeon: Fix minor issues
- Fix crash when dungeon_map_set_walked is called with x=0 or z=0
- Stairs' existence should be checked using stairs_texture, not
  stairs_orientation
2021-06-06 14:22:33 +09:00
kichikuou 7f326527a0 DrawDungeon: Draw map in the center of target texture
This fixes an issue where the map is drawn outside of the target
texture's boundaries.
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 c54f2493d1 DrawDungeon: Use billboarding for floating event markers
Before this, floating markers were rendered as OpenGL's point sprites.
But point sprites has an implementation-dependent maximum size, and
Intel driver's maximum (256 pixels) is too small for us.

After this, markers are drawn with the same shaders as normal objects,
using the billboarding technique.
2021-05-30 21:31:08 +09: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