diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index 32f1164..82a91db 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -137,6 +137,7 @@ void gfx_screen_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int 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_blend_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_bright_dest_only(Texture *dst, int x, int y, int w, int h, int rate); 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_stretch_blend(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh, int a); diff --git a/src/draw.c b/src/draw.c index de0401c..2d14221 100644 --- a/src/draw.c +++ b/src/draw.c @@ -650,6 +650,18 @@ void gfx_sub_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, restore_blend_mode(); } +void gfx_bright_dest_only(Texture *dst, int x, int y, int w, int h, int rate) +{ + GLfloat f_rate = rate / 255.0; + glBlendFuncSeparate(GL_ZERO, GL_CONSTANT_COLOR, GL_ZERO, GL_ONE); + glBlendColor(f_rate, f_rate, f_rate, 1.0); + + struct copy_data data = COPY_DATA(x, y, 0, 0, w, h); + run_copy_shader(©_shader.s, dst, NULL, &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 680e907..582af4d 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -221,7 +221,11 @@ static void DrawGraph_SubDA_DAxSA(int dst, int dx, int dy, int src, int sx, int gfx_sub_da_daxsa(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); } -//void DrawGraph_BrightDestOnly(int dst, int x, int y, int w, int h, int rate); +static void DrawGraph_BrightDestOnly(int dst, int x, int y, int w, int h, int rate) +{ + gfx_bright_dest_only(DTEX(dst), x, y, w, h, 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); @@ -433,7 +437,7 @@ HLL_LIBRARY(DrawGraph, HLL_EXPORT(SpriteCopyAMap, DrawGraph_SpriteCopyAMap), HLL_EXPORT(BlendDA_DAxSA, DrawGraph_BlendDA_DAxSA), HLL_EXPORT(SubDA_DAxSA, DrawGraph_SubDA_DAxSA), - //HLL_EXPORT(BrightDestOnly, DrawGraph_BrightDestOnly), + HLL_EXPORT(BrightDestOnly, DrawGraph_BrightDestOnly), //HLL_EXPORT(CopyTextureWrap, DrawGraph_CopyTextureWrap), //HLL_EXPORT(CopyTextureWrapAlpha, DrawGraph_CopyTextureWrapAlpha), HLL_EXPORT(CopyStretch, DrawGraph_CopyStretch),