Zeldara109

minigameXdoor.asm

Mar 31st, 2026 (edited)
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.99 KB | None | 0 0
  1. ; Converts minigame locked doors (sprite 04E) to function as they do on SNES.
  2.  
  3. ; Warning: this exactly replaces the vanilla sprite 04E init, no bytes to spare
  4.  
  5. .gba
  6. .open "sma3.gba", "sma3test-minigameXdoor.gba", 0x08000000
  7.  
  8. .org 0x080D5CE4
  9. LockedDoor_Init:
  10. .org 0x080D5C64
  11. XDoor_Init:
  12.  
  13. .org 0x080D5D48
  14. .area @AreaEnd-org()
  15.     cmp r0,0x0          ;\
  16.     bne @Unlocked       ;| replaced code, saves 2 bytes
  17.     mov r0,r4           ;|
  18.     bl LockedDoor_Init  ;|
  19.     b @Return           ;/
  20. @Unlocked:
  21. ; convert to X door and move 0x10 pixels downward
  22.     mov r1,0x01         ; sprite 001: X door
  23.     strh r1,[r4,0x32]   ; set sprite ID
  24.     ldr r0,[r4,0x4]
  25.     lsl r1,r1,0xC       ; r1 = 0x1000 (saves 2 bytes by shifting the sprite ID)
  26.     add r0,r1
  27.     str r0,[r4,0x4]     ; set Y position
  28. ; call sprite 001 init
  29.     mov r0,r4
  30.     bl XDoor_Init
  31. @Return:
  32.     pop {r4,pc}         ; compact return, saves 4 bytes
  33.  
  34.     .fill @AreaEnd-org()
  35. .endarea
  36. .org 0x080D5D68
  37. @AreaEnd:
  38.  
  39. .close
Advertisement
Add Comment
Please, Sign In to add comment