Advertisement
Erik557

optimization i/ii

Nov 9th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;Sprite Morph v2
  3. ;;By Erik557
  4. ;;Description: Turns a sprite into another one.
  5. ;;It has configurable settings.
  6. ;;No credit needed.
  7. ;;NOTE: Needs NMSTL
  8. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  9.  
  10. !MorphType = 0      ;Explained below
  11.  
  12.                     ;If morph type is 0:
  13. !SpriteType = 0     ;0 = Normal; 1 = Custom
  14.                     ;
  15.                     ;If morph type is 1:
  16.                     ;0 = Normal to custom; 1 = Custom to normal
  17.  
  18.  
  19. !SprNum = $0A       ;Sprite number
  20. !SprMorph = $15     ;Morph Result
  21.  
  22.  
  23. !Sound = $10        ;SFX
  24. !SFXBank = $1DF9    ;SFX Bank
  25.  
  26.  
  27. ;Don't touch these.
  28.  
  29. if !SpriteType == 1
  30.  
  31.         !Status = $3242
  32.         !SprRAM = $400083
  33.         !Extra = $400040
  34.  
  35. else
  36.  
  37.         !Status = $3242
  38.         !SprRAM = $3200
  39.         !Extra = $400040
  40.  
  41. endif
  42.  
  43. db $42
  44.  
  45. JMP Ret : JMP Ret : JMP Ret : JMP SpriteV : JMP SpriteH : JMP Ret : JMP Ret : JMP Ret : JMP Ret : JMP Ret
  46.  
  47. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48.  
  49. SpriteH:
  50. SpriteV:
  51.     LDA !SprRAM,x
  52.     CMP #!SprNum
  53.     BNE Ret
  54.    
  55.     LDA !Extra,x
  56.     AND #$08
  57. if !SpriteType == 1
  58.     BEQ Ret
  59. else
  60.     BNE Ret
  61. endif
  62.  
  63.     STZ !Status,x
  64.     LDA #!SprMorph
  65.    
  66.     if !MorphType == 1
  67.         if !SpriteType == 1
  68.             CLC
  69.         else
  70.             SEC
  71.         endif
  72.     else
  73.         if !SpriteType == 1
  74.             SEC
  75.         else
  76.             CLC
  77.         endif
  78.     endif
  79.     %spawn_sprite()
  80.     %create_smoke()
  81.     %move_spawn_to_sprite()
  82.        
  83.     LDA #!Sound
  84.     STA !SFXBank
  85. Ret:
  86.     RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement