aboutsummaryrefslogtreecommitdiff
path: root/map/utils.gbasm
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-05-02 15:28:14 +0200
committerAstatin <[email protected]>2025-05-02 15:28:14 +0200
commit4e618ff322cc0a6b1b7b8947983e4055b96e43d2 (patch)
treed28235e111fb147bfe3488a33a15dcd0d8012295 /map/utils.gbasm
parentf137ecaba8297bb99b33559832e3131fda3646c2 (diff)
Make stairs avoid bunny room
Diffstat (limited to 'map/utils.gbasm')
-rw-r--r--map/utils.gbasm29
1 files changed, 29 insertions, 0 deletions
diff --git a/map/utils.gbasm b/map/utils.gbasm
new file mode 100644
index 0000000..cf2c4ce
--- /dev/null
+++ b/map/utils.gbasm
@@ -0,0 +1,29 @@
+Pick_Random_Room_Avoid_A: ; input A = room to avoid (or FF if none), output A = chosen room idx
+ PUSH BC
+ CP $FF
+ JR Z, =.All_rooms_allowed
+ LD B, A
+ .Skip_bunny_room:
+ LD A, $mem_number_of_rooms
+ CP $01
+ JR Z, =.All_rooms_allowed
+
+ DEC A
+ CALL =RNG_Bound
+ INC A
+ LD C, A
+ LD A, B
+ CP C
+ LD A, C
+ JR C, =.Room_restriction.end
+ DEC A
+
+ JR =.Room_restriction.end
+
+ .All_rooms_allowed:
+ LD A, $mem_number_of_rooms
+ CALL =RNG_Bound
+ .Room_restriction.end:
+ POP BC
+ RET
+