Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Converts minigame locked doors (sprite 04E) to function as they do on SNES.
- ; Warning: this exactly replaces the vanilla sprite 04E init, no bytes to spare
- .gba
- .open "sma3.gba", "sma3test-minigameXdoor.gba", 0x08000000
- .org 0x080D5CE4
- LockedDoor_Init:
- .org 0x080D5C64
- XDoor_Init:
- .org 0x080D5D48
- .area @AreaEnd-org()
- cmp r0,0x0 ;\
- bne @Unlocked ;| replaced code, saves 2 bytes
- mov r0,r4 ;|
- bl LockedDoor_Init ;|
- b @Return ;/
- @Unlocked:
- ; convert to X door and move 0x10 pixels downward
- mov r1,0x01 ; sprite 001: X door
- strh r1,[r4,0x32] ; set sprite ID
- ldr r0,[r4,0x4]
- lsl r1,r1,0xC ; r1 = 0x1000 (saves 2 bytes by shifting the sprite ID)
- add r0,r1
- str r0,[r4,0x4] ; set Y position
- ; call sprite 001 init
- mov r0,r4
- bl XDoor_Init
- @Return:
- pop {r4,pc} ; compact return, saves 4 bytes
- .fill @AreaEnd-org()
- .endarea
- .org 0x080D5D68
- @AreaEnd:
- .close
Advertisement
Add Comment
Please, Sign In to add comment