aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-05 12:13:47 +1000
committerquou <quou@disroot.org>2024-10-05 12:13:47 +1000
commit0e75a2949678cb8a68fb0819355864aa6db2cb43 (patch)
treeabeb4ecb53649e520e4fcc1652ad870e3d7175fa /render.c
parent6cab1d56ad2b29a2556090f1f0ce7e2b72d5460a (diff)
Level transitions and main menu
Diffstat (limited to 'render.c')
-rw-r--r--render.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/render.c b/render.c
index 07af8cf..ff7670b 100644
--- a/render.c
+++ b/render.c
@@ -114,6 +114,34 @@ void ren_map(
}
}
+void ren_cmap(
+ Renderer* r,
+ int x,
+ int y,
+ const struct Rect* re,
+ const Bitmap* bm
+) {
+ Rect rect, su = *re;
+ const unsigned* data = (const unsigned*)&bm[1];
+ int i, j, sx, sy, ex, ey;
+ rect.x = x;
+ rect.y = y;
+ rect.w = re->w;
+ rect.h = re->h;
+ rect_clipsr(&rect, &su, r->clip);
+ ex = rect.x + rect.w;
+ ey = rect.y + rect.h;
+ for (j = rect.y, sy = su.y; j < ey; j++, sy++) {
+ for (i = rect.x, sx = su.x; i < ex; i++, sx++) {
+ int di = (i + j * r->w);
+ int si = (sx + sy * bm->w);
+ int bit = (1 << (si & 0x1f));
+ bit &= data[si >> 5];
+ r->t[di >> 5] &= ~((1 << (di & 0x1f)) * (bit != 0));
+ }
+ }
+}
+
void ren_rect(
Renderer* r,
const struct Rect* re