diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index 893bac1..e897d18 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -154,6 +154,7 @@ void gfx_copy_rot_zoom_amap(Texture *dst, Texture *src, int sx, int sy, int w, i void gfx_copy_rot_zoom_use_amap(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag); void gfx_copy_root_zoom2(Texture *dst, float cx, float cy, Texture *src, float scx, float scy, float rot, float mag); void gfx_copy_reverse_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); +void gfx_copy_reverse_UD(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_copy_reverse_amap_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_copy_rotate_y(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag); void gfx_copy_rotate_y_use_amap(Texture *dst, Texture *front, Texture *back, int sx, int sy, int w, int h, float rot, float mag); diff --git a/src/draw.c b/src/draw.c index 165380e..ecfbf45 100644 --- a/src/draw.c +++ b/src/draw.c @@ -891,6 +891,23 @@ void gfx_copy_reverse_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int restore_blend_mode(); } +void gfx_copy_reverse_UD(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) +{ + mat4 mw_transform = MAT4( + src->w, 0, 0, -sx, + 0, -src->h, 0, sy + h, + 0, 0, 1, 0, + 0, 0, 0, 1); + mat4 wv_transform = WV_TRANSFORM(w, h); + + glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ZERO, GL_ONE); + + struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h); + run_draw_shader(©_shader.s, dst, src, mw_transform, wv_transform, &data); + + restore_blend_mode(); +} + void gfx_copy_reverse_amap_LR(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) { mat4 mw_transform = MAT4( diff --git a/src/hll/DrawGraph.c b/src/hll/DrawGraph.c index e4ba504..d8de2b5 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -338,7 +338,10 @@ static void DrawGraph_CopyReverseLR(int dst, int dx, int dy, int src, int sx, in gfx_copy_reverse_LR(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); } -//void DrawGraph_CopyReverseUD(int dst, int dx, int dy, int src, int sx, int sy, int w, int h); +static void DrawGraph_CopyReverseUD(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) +{ + gfx_copy_reverse_UD(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); +} static void DrawGraph_CopyReverseAMapLR(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) { @@ -495,7 +498,7 @@ HLL_LIBRARY(DrawGraph, //HLL_EXPORT(CopyRotateXFixUUseAMap, DrawGraph_CopyRotateXFixUUseAMap), //HLL_EXPORT(CopyRotateXFixDUseAMap, DrawGraph_CopyRotateXFixDUseAMap), HLL_EXPORT(CopyReverseLR, DrawGraph_CopyReverseLR), - //HLL_EXPORT(CopyReverseUD, DrawGraph_CopyReverseUD), + HLL_EXPORT(CopyReverseUD, DrawGraph_CopyReverseUD), HLL_EXPORT(CopyReverseAMapLR, DrawGraph_CopyReverseAMapLR), //HLL_EXPORT(CopyReverseAMapUD, DrawGraph_CopyReverseAMapUD), HLL_EXPORT(CopyWidthBlur, DrawGraph_CopyWidthBlur), diff --git a/src/hll/Gpx2Plus.c b/src/hll/Gpx2Plus.c index e59105b..2a3458c 100644 --- a/src/hll/Gpx2Plus.c +++ b/src/hll/Gpx2Plus.c @@ -372,7 +372,14 @@ static void Gpx2Plus_CopyReverseLR(int destSurface, int dx, int dy, int srcSurfa gfx_copy_reverse_LR(dst, dx, dy, src, sx, sy, width, height); } -// void CopyReverseUD(int nDestSurface, int nDx, int nDy, int nSrcSurface, int nSx, int nSy, int nWidth, int nHeight); +static void Gpx2Plus_CopyReverseUD(int destSurface, int dx, int dy, int srcSurface, int sx, int sy, int width, int height) +{ + struct texture *dst = get_texture(destSurface); + struct texture *src = get_texture(srcSurface); + if (!dst || !src) + return; + gfx_copy_reverse_UD(dst, dx, dy, src, sx, sy, width, height); +} static void Gpx2Plus_CopyReverseAMapLR(int destSurface, int dx, int dy, int srcSurface, int sx, int sy, int width, int height) { @@ -745,7 +752,7 @@ HLL_LIBRARY(Gpx2Plus, HLL_EXPORT(CopyStretchReduce, Gpx2Plus_CopyStretchReduce), HLL_EXPORT(CopyStretchReduceAMap, Gpx2Plus_CopyStretchReduceAMap), HLL_EXPORT(CopyReverseLR, Gpx2Plus_CopyReverseLR), - // HLL_EXPORT(CopyReverseUD, Gpx2Plus_CopyReverseUD), + HLL_EXPORT(CopyReverseUD, Gpx2Plus_CopyReverseUD), HLL_EXPORT(CopyReverseAMapLR, Gpx2Plus_CopyReverseAMapLR), // HLL_EXPORT(CopyReverseAMapUD, Gpx2Plus_CopyReverseAMapUD), // HLL_EXPORT(BlendScreenWDS, Gpx2Plus_BlendScreenWDS),