diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index 6a02801..e86299d 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -111,6 +111,7 @@ void gfx_fill(struct texture *dst, int x, int y, int w, int h, int r, int g, int void gfx_fill_alpha_color(struct texture *dst, int x, int y, int w, int h, int r, int g, int b, int a); void gfx_fill_amap(struct texture *dst, int x, int y, int w, int h, int a); void gfx_add_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h); +void gfx_sub_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h); void gfx_copy_stretch(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh); void gfx_copy_stretch_amap(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh); void gfx_copy_rot_zoom(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag); diff --git a/src/draw.c b/src/draw.c index 4ce3204..0761be1 100644 --- a/src/draw.c +++ b/src/draw.c @@ -345,6 +345,16 @@ void gfx_add_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy restore_blend_mode(); } +void gfx_sub_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h) +{ + glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h); + run_copy_shader(©_shader.s, dst, src, &data); + + restore_blend_mode(); +} + // FIXME: DrawGraph.dll does some really strange clipping on the src/dst rectangles // before drawing. This implementation does what you would normally expect // a stretch function to do when passed negative (x,y) coordinates. diff --git a/src/hll/DrawGraph.c b/src/hll/DrawGraph.c index 2d62d16..fb92e67 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -102,6 +102,11 @@ static void DrawGraph_AddDA_DAxSA(int dst, int dx, int dy, int src, int sx, int gfx_add_da_daxsa(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); } +void DrawGraph_SubDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) +{ + gfx_sub_da_daxsa(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); +} + static void DrawGraph_CopyStretch(int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh) { gfx_copy_stretch(DTEX(dst), dx, dy, dw, dh, STEX(src), sx, sy, sw, sh); @@ -191,7 +196,6 @@ static void DrawGraph_SetFontName(struct string *text) //void DrawGraph_ScreenDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h); //void DrawGraph_SpriteCopyAMap(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int key); //void DrawGraph_BlendDA_DAxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h); -//void DrawGraph_SubDA_DAxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h); //void DrawGraph_BrightDestOnly(int dst, int x, int y, int w, int h, int rate); //void DrawGraph_CopyTextureWrap(int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh, int u, int v); //void DrawGraph_CopyTextureWrapAlpha(int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh, int u, int v, int alpha); @@ -261,7 +265,7 @@ HLL_LIBRARY(DrawGraph, HLL_EXPORT(AddDA_DAxSA, DrawGraph_AddDA_DAxSA), //HLL_EXPORT(SpriteCopyAMap, DrawGraph_SpriteCopyAMap), //HLL_EXPORT(BlendDA_DAxSA, DrawGraph_BlendDA_DAxSA), - //HLL_EXPORT(SubDA_DAxSA, DrawGraph_SubDA_DAxSA), + HLL_EXPORT(SubDA_DAxSA, DrawGraph_SubDA_DAxSA), //HLL_EXPORT(BrightDestOnly, DrawGraph_BrightDestOnly), //HLL_EXPORT(CopyTextureWrap, DrawGraph_CopyTextureWrap), //HLL_EXPORT(CopyTextureWrapAlpha, DrawGraph_CopyTextureWrapAlpha),