lorom
;------reveal bts------
; custom bts that disables layer 2 in order to show hidden passages
; made by tundain

; LIMITATIONS!
; you need to use a layer2 in the room, and it's scrolling speed should be set to 100% for x and y
; revealing a hidden passage reveals all at once (not that that would happen very often, I guess)

;How to setup:
; on the area that you wish to hide, draw the cover-up tiles on layer2 (make sure these tiles have layer priority set)
; draw the to-be-revealed area on layer1.
; if there are tiles were layer1 and layer2 will overlap, make sure the layer1 tiles don't have layer priority set
; (otherwise they just appear over layer2, obviously)
;enjoy! (and credit please

;defines (use air fool xray with these values)
!revealbts = 5
!hidebts = 6
!freeRam1 = $0B08
!freeRam2 = $0B28
; for the freeRam, 
;if you have different asm patches that also use these ram addresses, make sure to redefine these to some unused ram
; in order to find an unused Ram, head to -->https://patrickjohnston.org/ASM/Lists/Super%20Metroid/RAM%20map.asm and search for addresses that say "unused"
;freespace
!bank94freespace = $94B500


;code-----
org !revealbts*2+$9498AC
dw revealcode
org !hidebts*2+$9498AC
dw hidecode


org !bank94freespace
revealcode:
LDA !freeRam1
BNE skip
INC
STA !freeRam1
LDA $1982
STA !freeRam2
LDA #$0004
STA $1982
skip:
RTS

hidecode:
LDA !freeRam1
BNE reset
BRA skip
reset:
STZ !freeRam1
LDA !freeRam2
STA $1982
RTS

