Commit Graph
53 Commits
Author SHA1 Message Date
Nunuhara Cabbage 5924225bc2 Implement DrawGraph.BrightDestOnly 2022-05-03 21:08:01 -07:00
Nunuhara Cabbage 7fc60f6607 Implement DrawGraph.ScreenDA_DAxSA 2022-05-03 20:48:21 -07:00
Nunuhara Cabbage 44891458f1 Implement DrawGraph.SaturDP_DPxSA 2022-05-03 20:01:48 -07:00
Nunuhara Cabbage 703a66106f Implement DrawGraph.FillMultiply 2022-05-03 18:57:06 -07:00
Nunuhara Cabbage af33413826 Implement DrawGraph.FillScreen 2022-05-03 18:53:55 -07:00
Nunuhara Cabbage 54f6ece82d Implement DrawGraph.FillAMapGradationUD 2022-05-03 18:49:40 -07:00
Nunuhara Cabbage 3b75b6b545 Implement DrawGraph.BlendScreenAlpha
This completes the full suite of DrawGraph blending functions.
2022-05-02 21:18:49 -07:00
Nunuhara Cabbage e65560b67a Implement DrawGraph.BlendMultiply 2022-05-02 20:48:42 -07:00
Nunuhara Cabbage 2fd081234b Implement DrawGraph.BlendScreen 2022-05-02 20:43:16 -07:00
Nunuhara Cabbage 65be47e05b Implement DrawGraph.BlendUseAMapColor 2022-05-02 20:35:02 -07:00
Nunuhara Cabbage 9108ce19ea Implement DrawGraph.BlendAMapAlphaSrcBright 2022-05-02 18:19:09 -07:00
Nunuhara Cabbage 2f573803c4 Implement DrawGraph.BlendAMapBright 2022-05-02 17:01:23 -07:00
Nunuhara Cabbage 6d745054a4 Implement DrawGraph.BlendAMapSrcOnly 2022-05-02 16:20:40 -07:00
Nunuhara Cabbage 0fc5442e42 Implement DrawGraph.BlendAddSatur 2022-05-02 15:38:53 -07:00
Nunuhara Cabbage d482e165d6 Implement DrawGraph.BlendSrcBright 2022-05-02 15:12:40 -07:00
Nunuhara Cabbage f7b6da9679 Implement DrawGraph.BlendAMapColorAlpha
Used in the Rance VI credits.
2022-04-28 20:43:55 -07:00
Nunuhara Cabbage 9089fa1fd1 Rewrite fnl font renderer
Only unscaled glyph bitmaps are now cached in regular memory. Scaled
glyphs are stored as textures on the GPU. Only the alpha channel on
glyph textures is used, with the color being provided as an input to the
shader.

Outline and bold rendering is improved by using a simple dilate shader.
This looks okay but could be improved (the result is a bit blurry
still).
2022-04-28 19:13:27 -07:00
Nunuhara Cabbage 8fb0153963 SengokuRanceFont: anti-aliasing and glyph caching
This improves the look and (especially) the performance of text
rendering in the MangaGamer version of Sengoku Rance.

There are still some bugs/unimplemented features, but the game should be
more or less bearable to play in this state.
2022-04-24 17:19:27 -07:00
Nunuhara Cabbage 3b72b88e9c SengokuRanceFont improvements
The game now basically runs, but with very bad performance and lots of
aliasing on text.

Need to implement anti-aliasing and caching of rendered glyphs next.
2022-04-23 22:52:07 -07:00
Nunuhara Cabbage 95a7719b65 Implement DrawGraph.CopyRotateX,CopyRotateXUseAmap
Used in Tsuma Shibori.
2022-04-08 18:43:51 -07:00
Nunuhara Cabbage 11e4880def Handle all font weights
System 4 has 4 font weights: light, medium, bold and heavy bold.
SDL_ttf has 2 (normal and bold). For now, xsystem4 treats light/medium
as normal and bold/heavy-bold as bold.
2022-04-05 19:33:56 -07:00
kichikuou ba1dcd6e21 Fix StoatSpriteEngine.SP_SetDrawMethod
The method parameter of this function has a different meaning from that
of SACT2.SP_SetDrawMethod.

I've only checked it in Widenyo, but it seems 0 and 1 are valid values
and 1 is additive blending.
2022-03-25 10:49:25 +09:00
kichikuou 5a5916fbd5 Make the window resizable
We don't use SDL's rendering functions, so we have to scale the screen
and translate the mouse positions ourselves.
2022-01-08 11:31:37 +09:00
kichikuou 7caf009209 Add use_gles meson build option 2021-12-21 13:37:53 +09:00
kichikuou 2f64ee4d21 Do not use GLEW if USE_GLES is defined
GLEW does not support OpenGL ES so it shouldn't be used when targetting
OpenGL ES.
2021-12-21 13:11:34 +09:00
Nunuhara Cabbage 2046fded88 Use scene_dirty() on SDL_WINDEVENT_EXPOSED 2021-12-11 12:45:58 -08: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 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 ea513ca727 Implement SACT2.SaveCG
Used in Rance VI.
2021-05-22 17:07:14 +09: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
kichikuou 91213785a7 Implement DrawGraph.Copy{,AMap}{Width,Height}Blur 2021-05-16 22:04:40 +09: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 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 713a612d2c Implement DrawGraph.CopyWithAlphaMap
Used in Haru Urare.
2021-05-09 16:19:57 -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
kichikuou e5cb875f9b Implement DrawGraph.BlendAMapColor and DrawGraph.BlendDA_DAxSA
And fixes DrawGraph.SubDA_DAxSA.
2021-05-08 20:52:48 +09:00
Nunuhara Cabbage 0fb1ef1c05 Implement DrawGraph.FillWithAlpha
Used in Vanish!
2021-05-02 18:05:40 -07:00
Nunuhara Cabbage ffc08d40f0 Implement DrawGraph.SubDA_DAxSA
Used in ほいっぷハニー.
2021-04-22 20:25:47 -07:00
Nunuhara Cabbage f282c69266 Implement DrawGraph.CopyColorReverse
Just a copy operation that inverts colors. Used in Rance VI Sonogo.
2021-04-22 19:20:12 -07:00
Nunuhara Cabbage 7a5db00085 Merge branch 'mac-opengl' of https://github.com/kichikuou/xsystem4 into kichikuou-mac-opengl 2020-09-03 10:18:43 -07:00
Nunuhara Cabbage a901404d3c Declare global variables extern in headers
Recent versions of gcc seem to emit symbols for unadorned declarations,
leading to linker errors.
2020-09-03 10:15:25 -07:00
kichikuou 7fcacb3c16 Fix OpenGL issues on MacOS
MacOS does not support OpenGL compatibility profile, so the following
changes had to be made:

- Replaced deprecated texture2D() with texture() in shaders
- Renamed `texture` uniform variable to `tex`, to avoid name conflict
- Use VAO, which is mandatory in OpenGL 3 core profile
2020-09-03 23:16:08 +09:00
Nunuhara Cabbage d9e50ab809 Implement DrawGraph.blend 2020-08-27 17:22:03 -07:00
Nunuhara Cabbage d9d8a201e8 Implement miscellaneous HLL functions
Reduce console spam by implementing some commonly used functions.

DrawGraph.SetFontName
SACT2.Mouse_SetPos
SACT2.Sound_ReverseLR
2020-08-16 19:57:46 -07:00
Nunuhara Cabbage 45ebe96220 Handle explicitly set char spacing
Handle char spacing set up by SACT2.SP_SetTextCharSpace and
DrawGraph.SetFontSpace.
2020-08-15 10:33:23 -07:00
Nunuhara Cabbage 80f0e7b436 Allow specifying font paths on command line 2020-08-05 19:53:23 -07:00