From: Lukas Krickl Date: Sat, 20 Sep 2025 07:37:21 +0000 (+0200) Subject: chore: Added rectangel defs X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=10fd023578c82cba4eb4234a45584a4f42fa33ca;p=gbrg%2F.git chore: Added rectangel defs --- diff --git a/src/defs.s b/src/defs.s index 3876289..48ac0fe 100644 --- a/src/defs.s +++ b/src/defs.s @@ -15,6 +15,7 @@ #define ACTS_MAX 32 #define MAP_OBJ_MAX 32 +#define RECT_MAX 32 #define STACK_BEGIN 0xDFFF @@ -95,3 +96,23 @@ .de mo_row, 1 .de mo_dat, 2 .de mo_size, 0 + + ; rectangle collision flags +.se 1 + ; collides with player +.de RF_PLAYER, 1 + ; is a generic wall +.de RF_WALL, 2 + ; collides with enemy +.de RF_ENEMY, 4 + + ; rectangle struct +.se 0 + ; if flags == 0 the rectangle is free +.de r_flags, 1 +.de r_pos_y, 1 +.de r_pos_y_hi, 1 +.de r_pos_x, 1 +.de r_h, 1 +.de r_w, 1 +.de r_size, 0 diff --git a/src/macros.inc b/src/macros.inc index 0a05537..f7a3427 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -217,4 +217,16 @@ $1: xor a, a @done: .endscope +#endmacro + + ; defines a rectangle + ; inputs: + ; $1: collision flags + ; $2: y + ; $3: y hi + ; $4: x + ; $5: h + ; $6: w +#macro recdef + .db $1, $2, $3, $4, $5, $6 #endmacro diff --git a/src/wram.s b/src/wram.s index b1f0a68..94c8728 100644 --- a/src/wram.s +++ b/src/wram.s @@ -58,6 +58,7 @@ srand: .adv 2 player: .adv act_size actors: .adv act_size * ACTS_MAX map_objs: .adv mo_size * MAP_OBJ_MAX +rectangles: .adv r_size * RECT_MAX ; current row that is being drawn map_curr_row: .adv 1