diff options
author | Astatin <[email protected]> | 2025-06-03 14:51:59 +0200 |
---|---|---|
committer | Astatin <[email protected]> | 2025-06-03 14:51:59 +0200 |
commit | eca91612b60b5379f9e8d6ce6f51366db54aacc3 (patch) | |
tree | c5fad4dc000a5430958fa8b354f69b3ba6628fe6 /map/utils.gbasm | |
parent | f3a70613f78023c25d9a075231cb55639a75ee99 (diff) |
Add loading from pregenerated collision map
Diffstat (limited to 'map/utils.gbasm')
-rw-r--r-- | map/utils.gbasm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/map/utils.gbasm b/map/utils.gbasm index cf2c4ce..64b2de7 100644 --- a/map/utils.gbasm +++ b/map/utils.gbasm @@ -27,3 +27,44 @@ Pick_Random_Room_Avoid_A: ; input A = room to avoid (or FF if none), output A = POP BC RET +Pick_Room_Position_Avoid_A:; input A = room to avoid (or FF if none), output BC = XY position + CALL =Pick_Random_Room_Avoid_A +Pick_Room_position: ; input A = room to spawn in, output BC = XY position + PUSH HL + PUSH DE + SLA A + SLA A + ADD low($mem_room_list) + LD C, A + + LD B, high($mem_room_list) + + ; X + LD A, (BC) + LD D, A + INC BC + LD A, (BC) + INC A + CALL =RNG_Bound + ADD D + + LD H, A + + INC BC + + ; Y + LD A, (BC) + LD D, A + INC BC + LD A, (BC) + INC A + CALL =RNG_Bound + ADD D + LD L, A + + LD B, H + LD C, L + + POP DE + POP HL + RET |