Advertisement
Erik557

Untitled

Aug 4th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;==================================
  2. ; Sprite Morph Blocks v3
  3. ; By JESUS GRANDMAW
  4. ;==================================
  5. ; Turns a sprite into another one.
  6. ; It has configurable settings.
  7. ;==================================
  8.  
  9. db $42
  10. JMP Ret : JMP Ret : JMP Ret : JMP SpriteV : JMP SpriteH : JMP Ret : JMP Ret : JMP Ret : JMP Ret : JMP Ret
  11.  
  12. !MorphType = 0      ;Explained below
  13.  
  14.                     ;If morph type is 0:
  15. !SpriteType = 0     ;0 = Normal; 1 = Custom
  16.                     ;
  17.                     ;If morph type is 1:
  18.                     ;0 = Normal to custom; 1 = Custom to normal
  19.  
  20.  
  21. !SprNum = $80       ;Sprite number
  22. !SprMorph = $05     ;Morph Result (for shells, spawn a koopa instead.)
  23.  
  24.  
  25. !Sound = $10        ;Sound effect (default: Magikoopa Magic)
  26. !SFXBank = $1DF9    ;SFX Bank
  27.  
  28. ;Don't touch these.
  29.  
  30. if !SpriteType == 1
  31.     !SprDesc = "custom"
  32. else
  33.     !SprDesc = "normal"
  34. endif
  35.  
  36. ;==============================================
  37.  
  38. SpriteH:
  39. SpriteV:
  40. if !SpriteType == 1
  41.     LDA $7FAB9E,x
  42. else
  43.     LDA $9E,x               ;\
  44. endif
  45.     CMP #!SprNum            ; | Check if the correct sprite is stteping into the block
  46.     BNE Ret                 ;/
  47.  
  48.     LDA $14C8,x             ;\
  49.     CMP #$08                ; | We don't want a dead sprite to be morphed, do we?
  50.     BCC Ret                 ;/
  51.    
  52.     LDA $7FAB10,x           ;\
  53.     AND #$08                ; |
  54. if !SpriteType == 1         ; |
  55.     BEQ Ret                 ; | Check for correct sprite type
  56. else                        ; |
  57.     BNE Ret                 ; |
  58. endif                       ;/
  59.  
  60.     LDA #!SprMorph          ; Change the sprite number
  61. if !MorphType == 1
  62.     if !SpriteType == 0
  63.         STA $7FAB9E,x
  64.         JSL $07F7D2  ;\ Reset sprite tables
  65.         JSL $0187A7   ;/
  66.         LDA #$08
  67.         STA $7FAB10,x
  68.    
  69.     else
  70.         STA $9E,x
  71.         JSL $07F7D2   ; Reset sprite tables
  72.     endif
  73. else
  74.     if !SpriteType == 1
  75.         STA $7FAB9E,x
  76.         JSL $07F7D2   ;\ Reset sprite tables
  77.         JSL $0187A7  ;/
  78.         LDA #$08
  79.         STA $7FAB10,x
  80.     else
  81.         STA $9E,x
  82.         JSL $07F7D2   ; Reset sprite tables
  83.     endif
  84. endif
  85.     LDA #$09
  86.     STA $14C8,x
  87.  
  88.     %create_smoke()         ;\ Spawn smoke
  89.     PHY                     ;/
  90.     TAY                     ;\
  91.     LDA $D8,x               ; | Move smoke to sprite's position
  92.     STA $17C4,y             ; |
  93.     LDA $E4,x               ; |
  94.     STA $17C8,y            ;/
  95.     PLY
  96.     ;%sub_horz_pos()
  97.     ;STA $157C,x
  98.  
  99.     LDA #!Sound             ;\ Play sound
  100.     STA !SFXBank      ;/
  101. Ret:
  102.     RTL
  103.  
  104. print "This block will turn a !SprDesc sprite into another sprite."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement