Advertisement
Erik557

sweet

Nov 8th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Block500:
  2.  
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;;Sprite Morph v2
  5. ;;By Erik557
  6. ;;Description: Turns a sprite into another one.
  7. ;;It has configurable settings.
  8. ;;No credit needed.
  9. ;;NOTE: Needs NMSTL
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. !SpriteType = 0     ;0 = Normal; 1 = Custom
  13. !SprNum = $0F       ;Sprite number
  14. !SprMorph = $10     ;Morph Result
  15.  
  16. !SA1 = 1            ;SA-1 Utilisation (doesn't work with GPS)
  17.  
  18. !Sound = $10        ;SFX
  19. if !SA1 == 1
  20. !SFXBank = $7DF9    ;SFX Bank (SA-1)
  21. !Slots = 22         ;Sprite Slots (SA-1)
  22. else
  23. !SFXBank = $1DF9    ;SFX Bank
  24. !Slots = 12         ;Sprite Slots
  25. endif
  26.  
  27. ;Don't touch these.
  28. if !SpriteType == 1
  29.    
  30.     if !SA1 == 1
  31.         !Status = $3242
  32.         !SprRAM = $400083
  33.         !Extra = $400040
  34.     else
  35.         !Status = $14C8
  36.         !SprRAM = $7FAB9E
  37.         !Extra = $7FAB10
  38.     endif
  39. else
  40.     if !SA1 == 1
  41.         !Status = $3242
  42.         !SprRAM = $3200
  43.         !Extra = $400040
  44.     else
  45.         !Status = $14C8
  46.         !SprRAM = $9E
  47.         !Extra = $7FAB10
  48.         endif
  49. endif
  50. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  51.  
  52. .SpriteVert
  53. .SpriteHoriz
  54.     LDA !SprRAM,x
  55.     CMP #!SprNum
  56.     BNE Ret
  57.    
  58.     LDA !Extra,x
  59.     AND #$08
  60. if !SpriteType == 1
  61.     BNE MorphIt
  62. else
  63.     BEQ MorphIt
  64. endif
  65.  
  66. .PlayerBelow
  67. .PlayerAbove
  68. .PlayerSides
  69. .PlayerTopCorner
  70. .PlayerBodyInside
  71. .PlayerHeadInside
  72. .CapeTouch
  73. .FireballTouch
  74. Ret:
  75.     RTL
  76.  
  77. MorphIt:
  78.     STZ !Status,x
  79.    
  80. if !SA1 == 1
  81.             LDA #!Sound
  82.             STA !SFXBank
  83.         ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84.         ;;Manual Spawn Routine
  85.         ;;Generates a sprite. Compatible with manual custom
  86.         ;;block inserter, and with SA-1.
  87.         ;;Adapted from %spawn_sprite() GPS routine.
  88.         ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  89.             PHX
  90.             LDX #!Slots-1
  91.         -   LDA !Status,x
  92.             BEQ +
  93.             DEX
  94.             BPL -
  95.             BRA .no
  96.         +   LDA #!SprMorph
  97.             STA !SprRAM,x
  98.             JSL $07F7D2
  99.             if !SpriteType == 1
  100.                 JSL $0187A7
  101.                 LDA #$08
  102.                 STA !Extra,x
  103.             endif
  104.             LDA #$01
  105.             STA !Status,x
  106.             TXA
  107.             PLX
  108.  
  109.         ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  110.         ;;Fix sprite position
  111.         ;;Adapted from %move_spawn_to_sprite() GPS routine.
  112.         ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  113.             PHY
  114.             TAY
  115.             LDA $3216,x
  116.             STA $3216,y
  117.             LDA $3258,x
  118.             STA $3258,y
  119.             LDA $322C,x
  120.             STA $322C,y
  121.             LDA $326E,x
  122.             STA $326E,y
  123.             PLY
  124.             RTL
  125.         .no PLX : RTL
  126. else
  127.  
  128.     LDA #!SprMorph
  129.    
  130.     if !SpriteType == 1
  131.         SEC
  132.     else
  133.         CLC
  134.     endif
  135.     %spawn_sprite()
  136.     %move_spawn_to_sprite()
  137.    
  138.     %create_smoke()
  139.    
  140.     LDA #!Sound
  141.     STA !SFXBank
  142. endif  
  143.     RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement