Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Block500:
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Sprite Morph v2 (For Manual Custom Block Inserter)
- ;;By Erik557
- ;;Description: Turns a sprite into another one.
- ;;It has configurable settings.
- ;;NOTE: Needs NMSTL
- ;;DESIGNED FOR SA-1
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;BlockXXX:
- !MorphType = 0 ;Explained below
- ;If morph type is 0:
- !SpriteType = 0 ;0 = Normal; 1 = Custom
- ;
- ;If morph type is 1:
- ;0 = Normal to custom; 1 = Custom to normal
- !SprNum = $0A ;Sprite number
- !SprMorph = $15 ;Morph Result
- !Sound = $10 ;SFX
- !SFXBank = $7DF9 ;SFX Bank
- ;Don't touch these.
- !Slots = 22 ;Sprite Slots
- !Status = $3242
- !Extra = $400040
- if !SpriteType == 1
- !SprRAM = $400083
- else
- !SprRAM = $3200
- endif
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .SpriteVert
- .SpriteHoriz
- LDA !SprRAM,x ;\
- CMP #!SprNum ; | Check if the correct sprite is stteping into the block
- BNE Ret ;/
- LDA !Status,x ;\
- CMP #$08 ; | We don't want a dead sprite to be morphed, do we?
- BCC Ret ;/
- LDA !Extra,x ;\
- AND #$08 ; |
- if !SpriteType == 1 ; |
- BEQ Ret ; | Check for correct sprite type
- else ; |
- BNE Ret ; |
- endif ;/
- .PlayerBelow
- .PlayerAbove
- .PlayerSides
- .PlayerTopCorner
- .PlayerBodyInside
- .PlayerHeadInside
- .CapeTouch
- .FireballTouch
- Ret:
- RTL
- MorphIt:
- STZ !Status,x
- LDA #!Sound
- STA !SFXBank
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Manual Spawn Routine
- ;;Adapted from %spawn_sprite() GPS routine.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- PHX ; Preserve X
- LDX #!Slots-1 ;\
- - LDA !Status,x ; |
- BEQ .yes ; |Check for open slots
- DEX ; |
- BPL - ; |
- BRA .no ;/ Return if no slots open
- .yes LDA #!SprMorph ;\ Spawn sprite
- STA !SprRAM,x ;/
- JSL $07F7D2 ;\ Reset sprite tables
- if !SpriteType == 1 ; |
- JSL $0187A7 ;/ Custom ones too
- LDA #$08 ;\ Set extra bits
- STA !Extra,x ;/
- endif
- LDA #$01 ;\ Set status to alive
- STA !Status,x ;/
- TXA
- PLX ; Restore X
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Fix sprite position
- ;;Adapted from %move_spawn_to_sprite() GPS routine.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- PHY
- TAY
- LDA $3216,x
- STA $3216,y
- LDA $3258,x
- STA $3258,y
- LDA $322C,x
- STA $322C,y
- LDA $326E,x
- STA $326E,y
- PLY
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Smoke Routine
- ;;Adapted from %create_smoke() GPS routine.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- PHX ; Preserve X
- PHP ; Preserve processor status/flags
- SEP #$30 ; Set processor 8-bit mode
- LDX #$03 ;\
- .loop LDA $77C0,x ; | Check for smoke sprite number
- BNE .next ;/
- INC $77C0,x ; Increase sprite number
- LDA #$1B ;\ Set smoke timer
- STA $77CC,x ;/
- LDA $3216 ;\
- AND #$F0 ; | Set Y-Pos
- STA $77C4,x ;/
- LDA $322C ;\
- AND #$F0 ; | Set X-Pos
- STA $77C8,x ;/
- BRA .ret
- .next DEX ;\ Check next slot
- BPL .loop ;/
- .ret PLP ; Restore processor status/flags
- .no PLX
- RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement