From 91c84e9988f450a19b2113e0ff57caa82c4ca809 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Mon, 9 Dec 2019 15:08:30 -0800 Subject: [PATCH] Implement DrawGraph.BlendAMapAlpha --- hll/DrawGraph.c | 2 +- sact.h | 1 + sact_graphics.c | 5 +++++ sdl_core.h | 1 + sdl_draw.c | 7 +++++++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hll/DrawGraph.c b/hll/DrawGraph.c index f443004..eefc9ce 100644 --- a/hll/DrawGraph.c +++ b/hll/DrawGraph.c @@ -50,7 +50,7 @@ hll_unimplemented(DrawGraph, BlendAMapColor); //void BlendAMapColorAlpha(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nR, int nG, int nB, int nAlpha) hll_unimplemented(DrawGraph, BlendAMapColorAlpha); //void BlendAMapAlpha(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha) -hll_unimplemented(DrawGraph, BlendAMapAlpha); +hll_defun_inline(BlendAMapAlpha, (DrawGraph_BlendAMapAlpha(a[0].i, a[1].i, a[2].i, a[3].i, a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0)); //void BlendAMapBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nRate) hll_unimplemented(DrawGraph, BlendAMapBright); //void BlendAMapAlphaSrcBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha, int nRate) diff --git a/sact.h b/sact.h index f0c59d0..c31a530 100644 --- a/sact.h +++ b/sact.h @@ -78,6 +78,7 @@ void DrawGraph_CopyAMapMax(int dno, int dx, int dy, int sno, int sx, int sy, int void DrawGraph_CopyAMapMin(int dno, int dx, int dy, int sno, int sx, int sy, int w, int h); void DrawGraph_BlendAMap(int dno, int dx, int dy, int sno, int sx, int sy, int w, int h); +void DrawGraph_BlendAMapAlpha(int dno, int dx, int dy, int sno, int sx, int sy, int w, int h, int alpha); void DrawGraph_Fill(int sp_no, int x, int y, int w, int h, int r, int g, int b); void DrawGraph_FillAMap(int sp_no, int x, int y, int w, int h, int a); diff --git a/sact_graphics.c b/sact_graphics.c index a3dfc41..ebeb5eb 100644 --- a/sact_graphics.c +++ b/sact_graphics.c @@ -567,6 +567,11 @@ void DrawGraph_BlendAMap(int dno, int dx, int dy, int sno, int sx, int sy, int w sdl_blend_amap(get_surface(dno)->cg, dx, dy, get_surface(sno)->cg, sx, sy, w, h); } +void DrawGraph_BlendAMapAlpha(int dno, int dx, int dy, int sno, int sx, int sy, int w, int h, int alpha) +{ + sdl_blend_amap_alpha(get_surface(dno)->cg, dx, dy, get_surface(sno)->cg, sx, sy, w, h, alpha); +} + void DrawGraph_Fill(int sp_no, int x, int y, int w, int h, int r, int g, int b) { sdl_fill(get_surface(sp_no)->cg, x, y, w, h, r, g, b); diff --git a/sdl_core.h b/sdl_core.h index 4385786..18863b2 100644 --- a/sdl_core.h +++ b/sdl_core.h @@ -52,6 +52,7 @@ void sdl_copy_use_amap_border(struct cg *dst, int dx, int dy, struct cg *src, in void sdl_copy_amap_max(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sy, int w, int h); void sdl_copy_amap_min(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sy, int w, int h); void sdl_blend_amap(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sy, int w, int h); +void sdl_blend_amap_alpha(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sy, int w, int h, int alpha); void sdl_fill(struct cg *dst, int x, int y, int w, int h, int r, int g, int b); void sdl_fill_alpha_color(struct cg *dst, int x, int y, int w, int h, int r, int g, int b, int a); void sdl_fill_amap(struct cg *dst, int x, int y, int w, int h, int a); diff --git a/sdl_draw.c b/sdl_draw.c index 03323d5..14bf735 100644 --- a/sdl_draw.c +++ b/sdl_draw.c @@ -310,6 +310,13 @@ void sdl_blend_amap(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sdl_cg_blit(dst, dx, dy, src->s, sx, sy, w, h); } +void sdl_blend_amap_alpha(struct cg *dst, int dx, int dy, struct cg *src, int sx, int sy, int w, int h, int alpha) +{ + SDL_SetSurfaceAlphaMod(src->s, alpha); + sdl_cg_blit(dst, dx, dy, src->s, sx, sy, w, h); + SDL_SetSurfaceAlphaMod(src->s, 255); +} + static void sdl_pixop_fill_rgb(uint32_t *p, uint32_t c) { PIXEL_SET_A(&c, PIXEL_A(*p));