Commit Graph
515 Commits
Author SHA1 Message Date
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 b9f9995cba Merge pull request #36 from kichikuou/gles
Support OpenGL ES 3.0
2021-06-20 10:59:45 -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
Nunuhara Cabbage 77a13515eb Merge pull request #35 from kichikuou/dungeon
DrawDungeon14: Draw roofs and polygon objects
2021-06-19 15:50:22 -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
Nunuhara Cabbage a48786b2e6 Merge pull request #34 from kichikuou/dungeon
Partial implementation of DrawDungeon14.hll (GALZOO Island)
2021-06-13 07:07:44 -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
Nunuhara Cabbage efdcd5d898 Merge pull request #33 from kichikuou/bezier
Implement Math.BezierCurve
2021-06-12 23:34:02 -07: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
Nunuhara Cabbage 14018b62eb Merge pull request #32 from kichikuou/DrawSimpleText
Implement DrawSimpleText HLL
2021-06-12 21:38:16 -07:00
kichikuou 66d6fc38da Implement DrawSimpleText HLL
Used in GALZOO Island.
2021-06-13 13:14:57 +09:00
Nunuhara Cabbage c1667c5e9f Merge pull request #31 from kichikuou/SpriteCopyAMap
Implement DrawGraph.SpriteCopyAMap
2021-06-12 21:10:02 -07: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
Nunuhara Cabbage 741717a325 Merge pull request #30 from kichikuou/SP_GetMaxZ
Fix SACT2.SP_GetMaxZ
2021-06-11 19:40:28 -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
Nunuhara Cabbage d99437e414 Merge pull request #29 from kichikuou/dungeon
More DrawDungeon improvements
2021-06-06 16:16:56 -07:00
kichikuou 1522c85e46 DrawDungeon: Tweak fog parameters 2021-06-06 14:22:33 +09: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
Nunuhara Cabbage 3b72131767 Merge pull request #28 from kichikuou/dungeon
DrawDungeon improvements
2021-05-30 18:49:03 -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
Nunuhara Cabbage 9983ff2bc9 Implement GoatGUIEngine text rendering 2021-05-24 12:36:55 -07: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