From: Lukas Krickl Date: Sun, 4 Jan 2026 15:20:42 +0000 (+0100) Subject: sprite: Added overlay sprite def X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=31972c7408e6f4b3e6a0f466d8fd88dc0aa3b3d4;p=gbrg%2F.git sprite: Added overlay sprite def --- diff --git a/src/defs.s b/src/defs.s index 3b0875c..4c9cdd8 100644 --- a/src/defs.s +++ b/src/defs.s @@ -313,3 +313,18 @@ .de dv_right, 2 .de dv_size, 0 + +#define OS_WIDTH 4 +#define OS_HEIGHT 4 + + ; overlay sprite struct +.se 0 + ; amount of sprite slots this overlay needs +.de os_slots, 1 +.de os_y, 1 +.de os_x, 1 + ; all overlays are 4x4 tile ids + ; ids of 0 are skipped and not rendered + ; the coordinates are fixed +.de os_data, (OS_WIDTH * OS_HEIGHT) +.de os_size, 0 diff --git a/src/macros.inc b/src/macros.inc index ed4979b..5bec092 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -240,3 +240,13 @@ $1: .db $1, $2, $3, $4, $5 dw $6 #endmacro + + ; defines an overlay sprite + ; inputs: + ; $1: amount of slots + ; $2: y position + ; $3: x position + ; should be followed by include of tilemap (OS_W*OS_H) +#macro osdef + .db $1, $2, $3 +#endmacro diff --git a/src/sprites.s b/src/sprites.s index 057b2dc..e33b9bb 100644 --- a/src/sprites.s +++ b/src/sprites.s @@ -1,4 +1,5 @@ ; this file contains rendering code for sprite overlays ; this can be e.g. weapons displayed in first person view +osdef 6, 20, 20 #include "sword.inc"